|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-28 12:26 UTC] johannes@php.net
[2007-07-28 12:53 UTC] mitch dot pascual at phpugph dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 11:00:01 2025 UTC |
Description: ------------ return 0 value when there's no specified 0 value in array Reproduce code: --------------- <?php $array1 = array(?php?, ?java?, ?ruby?, ?asp?); $array2 = array(?php? => ?PHP.net?, ?java? => ?java.com?, 0 => ?javascript?, 1 => ?actionscript?); foreach ($array2 as $key => $value) { if ( in_array($key, $array1) ) { print ?in array: $key <br />?; } else { print ?not in array: $key <br />?; } # end if } # end foreach ?> Expected result: ---------------- in array: php in array: java not in array: 0 not in array: 1 Actual result: -------------- in array: php in array: java in array: 0 not in array: 1