note 107407 added to language.types.array
| From: | Anonymous | Date: | Mon, 06 Feb 2012 23:22:35 +0000 |
| Subject: | note 107407 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185886@lists.php.net to get a copy of this message | ||
Here's an easier way to access associative array values by their numeric index:
<?php
//sample associative array:
$myAssocArray = array('a'=>'apple', 'b'=>'banana',
'c'=>'carrot', 'd'=>'dragon fruit');
$numKeys = array_values($myAssocArray);
echo $numKeys[0]; // => apple
echo $numKeys[1]; // => banana
echo $numKeys[2]; // => carrot
echo $numKeys[3]; // => dragon fruit
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.219.151.91
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/107407
Del: integrated -- https://master.php.net/note/delete/107407/integrated
Del: useless -- https://master.php.net/note/delete/107407/useless
Del: bad code -- https://master.php.net/note/delete/107407/bad+code
Del: spam -- https://master.php.net/note/delete/107407/spam
Del: non-english -- https://master.php.net/note/delete/107407/non-english
Del: in docs -- https://master.php.net/note/delete/107407/in+docs
Del: other reasons-- https://master.php.net/note/delete/107407
Reject -- https://master.php.net/note/reject/107407
Search -- https://master.php.net/manage/user-notes.php