note 57671 added to function.key

From: Date: Mon, 10 Oct 2005 23:17:44 +0000
Subject: note 57671 added to function.key
Groups: php.notes 
Request: Send a blank email to php-notes+get-96801@lists.php.net to get a copy of this message
Note that key($array) returns NULL if $array's internal pointer goes past the end of the array. For example, the following code: <?php $arr = array( 'one' => '1', 'two' => '2', 'three' => '3', 'four' => '4', 'five' => '5'); for ($i = 0; $i < 10; $i++) { var_dump(key($arr)); next($arr); } ?> results in: string(3) "one" string(3) "two" string(5) "three" string(4) "four" string(4) "five" NULL NULL NULL NULL NULL ---- Manual Page -- http://www.php.net/manual/en/function.key.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57671 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57671&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57671&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#96801) next »