note 93871 added to function.array-keys
| From: | rarioj at gmail dot com | Date: | Mon, 05 Oct 2009 01:38:32 +0000 |
| Subject: | note 93871 added to function.array-keys | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161297@lists.php.net to get a copy of this message | ||
Sometimes we want to find out the last added numerical key right after we use "
array_push($array, $value) " or " $array[] = $value ". This can be achieved by
calling:
<?php
return array_pop(array_keys($array));
?>
----
Server IP: 202.158.52.162
Probable Submitter: 125.167.108.115
----
Manual Page -- http://www.php.net/manual/en/function.array-keys.php
Edit -- https://master.php.net/note/edit/93871
Del: integrated -- https://master.php.net/note/delete/93871/integrated
Del: useless -- https://master.php.net/note/delete/93871/useless
Del: bad code -- https://master.php.net/note/delete/93871/bad+code
Del: spam -- https://master.php.net/note/delete/93871/spam
Del: non-english -- https://master.php.net/note/delete/93871/non-english
Del: in docs -- https://master.php.net/note/delete/93871/in+docs
Del: other reasons-- https://master.php.net/note/delete/93871
Reject -- https://master.php.net/note/reject/93871
Search -- https://master.php.net/manage/user-notes.php