|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-08 09:03 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
Description: ------------ combination of array with zero as the second key and foreach loop is causing false equality. See simple example below... ./configure --with-apxs=/work/st/daemons/apache/bin/apxs --disable-libxml --prefix=/work/st/daemons/php --with-zlib --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear Reproduce code: --------------- <?php /*>*/; $value = 'T'; $options = array('T' => 'TBD', '0' => 'Level 0', '1' => 'Level 1', '2' => 'Level 2' ); var_dump($options); echo '<br>'; foreach($options as $val => $txt) { if($value == $val) { echo "$value == $val<br>" ; } } ?> Expected result: ---------------- I expect to ONLY see T == T. Actual result: -------------- result is: T == T T == 0