note 68052 added to function.end

From: Date: Tue, 11 Jul 2006 19:48:15 +0000
Subject: note 68052 added to function.end
Groups: php.notes 
Request: Send a blank email to php-notes+get-114677@lists.php.net to get a copy of this message
This function returns the value at the end of the array, but you may sometimes be interested in the key at the end of the array, particularly when working with non integer indexed arrays: <?php // Returns the key at the end of the array function endKey($array){ end($array); return key($array); } ?> Usage example: <?php $a = array("one" => "apple", "two" => "orange", "three" => "pear"); echo endKey($a); // will output "three" ?> ---- Server IP: 66.207.199.35 Probable Submitter: 69.159.216.64 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.end.php Edit -- http://master.php.net/note/edit/68052 Del: integrated -- http://master.php.net/note/delete/68052/integrated Del: useless -- http://master.php.net/note/delete/68052/useless Del: bad code -- http://master.php.net/note/delete/68052/bad+code Del: spam -- http://master.php.net/note/delete/68052/spam Del: non-english -- http://master.php.net/note/delete/68052/non-english Del: in docs -- http://master.php.net/note/delete/68052/in+docs Del: other reasons-- http://master.php.net/note/delete/68052 Reject -- http://master.php.net/note/reject/68052 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114677) next »