note 92436 deleted from function.in-array by danbrown
| From: | danbrown@php.net | Date: | Fri, 24 Jul 2009 12:55:12 +0000 |
| Subject: | note 92436 deleted from function.in-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158687@lists.php.net to get a copy of this message | ||
Note Submitter: mwm03c at fsu dot edu
----
@brianko: as john just mentioned below, in_array() was recognizing that string in your array because
strings seem to evaluate to 0 when they begin with non-digits (so "?gopher" was matched to
0). Adding the optional strict parameter (ex. in_array($item, $raw_item_types, true)) would have
fixed the problem because then "?gopher" !== 0.
You also have two bugs in your code:
1. missing ";" after assigning "?gopher" to $item
2. $raw_data_item_types is assigned the array, but $item is checked against $raw_item_types - an
uninitialized variable