#47264 [Opn->Bgs]: currtent($myArray) not returning correct item

From: Date: Mon, 02 Feb 2009 00:51:36 +0000
Subject: #47264 [Opn->Bgs]: currtent($myArray) not returning correct item
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133351@lists.php.net to get a copy of this message
 ID:               47264
 Updated by:       colder@php.net
 Reported By:      george at shoutbomb dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: windows 2003
 PHP Version:      5.2.8
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

That's because you don't move the array pointer. See next().


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

[2009-02-01 23:04:57] george at shoutbomb dot com

Description:
------------
When requesting the 'current' pointer in an array it always returns the
'first' item.

Reproduce code:
---------------
$search_array = array('first' => 1, 'second' => 4,'third' =>
51,
'fourth' => 54,'fifth' => 15);
if (array_key_exists('fourth', $search_array)) {
    echo current($search_array);
}

Expected result:
----------------
Expecting the 'fourth' item.

Actual result:
--------------
Always returns the 'first' item.


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


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



Thread (2 messages)

« previous php.bugs (#133351) next »