note 120146 added to function.in-array
| From: | hoopyfroop at yahoo dot com | Date: | Fri, 11 Nov 2016 02:14:59 +0000 |
| Subject: | note 120146 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207068@lists.php.net to get a copy of this message | ||
If you search for numbers, in_array will convert any strings in your array to numbers, dropping any
letters/characters, forcing a numbers-to-numbers comparison. So if you search for 1234, it will say
that '1234abcd' is a match. Example:
<?php
$test_array = array('test', '1234abcd');
if (in_array(1234, $test_array)) {
echo '1234 is a match!';
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 50.247.122.214
----
Manual Page -- http://php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/120146
Del: integrated -- https://master.php.net/note/delete/120146/integrated
Del: useless -- https://master.php.net/note/delete/120146/useless
Del: bad code -- https://master.php.net/note/delete/120146/bad+code
Del: spam -- https://master.php.net/note/delete/120146/spam
Del: non-english -- https://master.php.net/note/delete/120146/non-english
Del: in docs -- https://master.php.net/note/delete/120146/in+docs
Del: other reasons-- https://master.php.net/note/delete/120146
Reject -- https://master.php.net/note/reject/120146
Search -- https://master.php.net/manage/user-notes.php