note 102856 modified in function.key by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Mar 2011 15:17:46 +0000 |
| Subject: | note 102856 modified in function.key by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177747@lists.php.net to get a copy of this message | ||
Just to illustrate the behaviour of the internal pointer when you add items. Adding to an array does
not affect the internal pointer.
<?php
$a = array();
var_dump(key($a)); // null
$a[] = "jump";
var_dump(key($a)); // 0
$a[] = "lazy";
var_dump(key($a)); // 0
end($a);
var_dump(key($a)); // 1
$a[] = "fox";
var_dump(key($a)); // 1
?>
--was--
Just to illustrate the behaviour of the internal pointer when you add items. Adding to an array does
not affect the internal pointer.
$a = array();
var_dump(key($a)); // null
$a[] = "jump";
var_dump(key($a)); // 0
$a[] = "lazy";
var_dump(key($a)); // 0
end($a);
var_dump(key($a)); // 1
$a[] = "fox";
var_dump(key($a)); // 1
http://php.net/manual/en/function.key.php