Question: EDIT: SOLVED - works as expected. Issue was with $search variable. Thanks for all of your help.

I have a typical WHILE that looks like this:

```
while ($row = $result->fetch_assoc())

```

In my $row, I have a user\_name key that looks like $row["user\_name"].

I have a variable called $search.

Theoretically, $search could be in another key in the $row array, for example is could also be in $row["user\_id"].

I'm trying to use stripos to see if there's a non-case-sensitive instance where $search is "like", or in the key, $row["user\_name"].

I've even tried storing $row["user\_name"] in a separate variable.

Basically.

```
if(stripos($row["user_id"],$search) !== false){
echo("working");
}

```

This never happens. Please help!

Edit:
Let me rephrase.

All I need to do is see if the $row["user\_name"] CONTAINS what's in the string variable $search.

I've tried to convert $row["user\_name"] into an array, a string, etc and tried in\_array and stripos and nothing works.

The below will work:

```
if (stripos("hey you guys","guys")){
    echo("worked");
    }

```

But what I need is

```
if (stripos($row["user_name"],$search)){
    echo("worked");
    }

```

Edit:
var\_dump looks like
array(2) { ["user\_id"]=> string(3) "133" ["user\_name"]=> string(3) "mrp" }

Edit:
I already verified that both $row["user\_name"] and $search are strings so I don't get the issue.

Answer: 
When you use `fetch_assoc`, it returns not an array, but an object.
So try different syntax:

```
stripos($row->user_id, $search) 

```
```
$string = str_replace($search,"",$row['user_id']);
$ctr = count($string);
   if($ctr>0) {echo 'found!';}
   else {echo 'not found!';}

```