|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-04 20:33 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 10:00:01 2025 UTC |
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.