note 103574 deleted from function.end by danbrown
| From: | danbrown@php.net | Date: | Wed, 20 Apr 2011 18:45:37 +0000 |
| Subject: | note 103574 deleted from function.end by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179026@lists.php.net to get a copy of this message | ||
Note Submitter: untilzero at gmail dot com
----
<?php
// this is incorrect / bad practice
$key = array_pop(array_keys($array));
// this is the correct way (array_pop() expects a variable passed by reference)
$tmp = array_keys($array);
$key = array_pop($tmp); // $key = end($tmp); would work here as well
?>