note 37723 added to function.current
| From: | jdpipe at yahoo dot co dot uk | Date: | Mon, 24 Nov 2003 14:08:49 +0000 |
| Subject: | note 37723 added to function.current | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60912@lists.php.net to get a copy of this message | ||
You can't get a pointer to an element in an array using the 'current' construct, for
example:
<?php
$a=array();
$a[]='aaa';
$a[]='bbb';
$a[]='ccc';
$a[]='ddd';
$a[]='eee';
reset($a);
next($a);
$v =& current($a);
$v = 'xxxx';
// array is not changed
print_r($a);
next($a);
$v =& $a[key($a)];
$v = 'yyy';
// now the array is changed
print_r($a);
?>
----
Manual Page -- http://www.php.net/manual/en/function.current.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37723
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37723&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37723&report=yes
Search -- http://master.php.net/manage/user-notes.php