ID: 37235 Updated by: [EMAIL PROTECTED] Reported By: hodacsi at mailbox dot hu -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows PHP Version: 5.1.2 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Set the third (optional) parameter to TRUE if you want to do strict checks, else type conversions (int in this case) will be performed. Previous Comments: ------------------------------------------------------------------------ [2006-04-28 11:08:25] hodacsi at mailbox dot hu Description: ------------ The code speaks for itself: in_array founds a string in the array when it definitely should not. The code is kept simple - I've also used variables and verified variable types with gettype, so it's _should not_ be a matter of using strict parameter. Using the third 'strict' parameter it works as expected, even if it's definitely not a question of types. Tested under several PHP versions and platforms. Reproduce code: --------------- <?php $ids = Array ( '+36901112222', 'xxxxx', 'zzzzz' ); echo in_array( ' 36901112222', $ids ) ? 'found' : 'not found'; ?> Expected result: ---------------- It should not find the string and should echo "not found". Actual result: -------------- "found" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37235&edit=1
