note 101078 deleted from function.array-keys by danbrown
| From: | danbrown@php.net | Date: | Wed, 24 Nov 2010 19:34:33 +0000 |
| Subject: | note 101078 deleted from function.array-keys by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174335@lists.php.net to get a copy of this message | ||
Note Submitter: aowie1 at gmail dot com
----
//this function will return a key name based on an index you pass
function getKey($arr, $i){
$keys = array_keys($arr);
return $keys[$i];
}
//Example:
$arr = array("Fname"=>"testy", "Lname"=>"testerson");
echo getKey($arr, 2);
//outputs "Lname";