note 95318 added to function.end
| From: | Alexander at example dot com | Date: | Sun, 27 Dec 2009 03:05:29 +0000 |
| Subject: | note 95318 added to function.end | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164343@lists.php.net to get a copy of this message | ||
To my previous note:
Sorry to make it probably a bit unclear about reference. I meant function to return value of key and
not reference to key. That means you can change value for this key in your array but not the key
itself.
You can do
<?php
$somelastkey = lastkey($somearray);
$somearray[$somelastkey] = $newvalue;
?>
but you cannot do
<?php
$somelastkey = & lastkey($somearray);
$somelastkey = $newkey;
?>
If you really need to change last key (saving value), you probably should save value for this key,
unset this element and create new one with desired key and saved value.
----
Server IP: 195.54.192.44
Probable Submitter: 95.25.171.241
----
Manual Page -- http://www.php.net/manual/en/function.end.php
Edit -- https://master.php.net/note/edit/95318
Del: integrated -- https://master.php.net/note/delete/95318/integrated
Del: useless -- https://master.php.net/note/delete/95318/useless
Del: bad code -- https://master.php.net/note/delete/95318/bad+code
Del: spam -- https://master.php.net/note/delete/95318/spam
Del: non-english -- https://master.php.net/note/delete/95318/non-english
Del: in docs -- https://master.php.net/note/delete/95318/in+docs
Del: other reasons-- https://master.php.net/note/delete/95318
Reject -- https://master.php.net/note/reject/95318
Search -- https://master.php.net/manage/user-notes.php