Question: The following code is producing this error:

Warning: number\_format() expects parameter 1 to be double, string given in /home/as1609/public\_html/branchscreen/search.php on line 154

```
            if (in_array($field, ['c', 'w', 'x', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'bd', 'be', 'br', 'bu', 'bx', 'by']) && $item[$field] > 999) {
                $item[$field] = number_format($item[$field], 0, '.', ',');

```

Any idea why?

Answer: 
The number\_format() function requires a float type variable for its first parameter.

Try casting the parameter like this: (float)$item[$field]

```
$field='x';
    $item[$field]='2929.69';
    if (in_array($field, ['c', 'w', 'x', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'bd', 'be', 'br', 'bu', 'bx', 'by']) && $item[$field] > 999) {
       echo  $item[$field] = number_format((float)$item[$field], 0, '.', ',');
    }

```

It's possible you have some spaces or , instead of . (float) will parse that correct way
You're trying to format an string as a number, which will not work.

Can you post the value of `$item['c']` so we can see what sort of data we will see?

Or better yet, post the value of `$item`.