ID: 39383 User updated by: lamotkin at softhome dot net Reported By: lamotkin at softhome dot net Status: Bogus Bug Type: Arrays related Operating System: Windows 98 PHP Version: 5.2.0 New Comment:
Oops, I realized a nonsense in my logic, the 'in_array' in examples above search for the values, not keys, and they probably will work right. I corrected my real script (which implies a bit more complicated code), and the described is not an issue for me now ... Sorry, Derick, for wasting your precious time. Please delete this "bug" from the database. Previous Comments: ------------------------------------------------------------------------ [2006-11-04 21:45:40] [EMAIL PROTECTED] Maybe, but we can't just start breaking things for people so we ain't changing this. ------------------------------------------------------------------------ [2006-11-04 21:21:09] lamotkin at softhome dot net Well, you are right, Derick, the doc covered the issue. But I believe this is a software design error, because neither in_array($some_var, $Test, true) nor in_array($some_var, $Test, false) produces no correct results. But if array keys would be of the type specified on definition, the in_array($some_var, $Test, true) work right. ------------------------------------------------------------------------ [2006-11-04 20:38:01] [EMAIL PROTECTED] 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 . ------------------------------------------------------------------------ [2006-11-04 20:33:55] lamotkin at softhome dot net Description: ------------ PHP erroneously converts keys to integer if possible, but my script is type-sensitive with that code. Reproduce code: --------------- $Test = array( "" => "No set", "1" => "Yes", "0" => "No"); var_dump($Test); echo "<p>"; $Test = array( "" => "No set", 1 => "Yes", 0 => "No"); var_dump($Test); echo "<p>"; Expected result: ---------------- 'var_dump's must NOT be the same Actual result: -------------- 'var_dump's ARE the same ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39383&edit=1