ID:               42131
 User updated by:  mitch dot pascual at phpugph dot com
 Reported By:      mitch dot pascual at phpugph dot com
 Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      5.2.3
 New Comment:

Hi,

On the code I provided, how come that there's a value 0 on the array
($array1)? Can you please explain it further?

Thanks a lot!


Previous Comments:
------------------------------------------------------------------------

[2007-07-28 12:26:11] [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

.

------------------------------------------------------------------------

[2007-07-28 11:58:29] mitch dot pascual at phpugph dot com

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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42131&edit=1

Reply via email to