View Single Post
Old 06-28-2009, 02:26 AM   #1 (permalink)
benton
The Contributor
 
Join Date: Apr 2008
Posts: 78
Thanks: 0
benton is on a distinguished road
Default Getting name of array

Given a multi array like this
Code:
 Array
(
    [warranty15] => Array
        (
            [id] => 15 year
            [text] => 15 Years
        )

    [warranty20] => Array
        (
            [id] => 20 year
            [text] => 20 Years
        )

    [warranty25] => Array
        (
            [id] => 25 year
            [text] => 25 Years
        )
}
If I run this code, it prints out the contents of each array.
PHP Code:
    foreach ($myArray as $key)
    {
      echo 
$key['id'].' - '.$key['text'].'<br>';
    } 
But I need to get the name of those arrays, like warranty15 and warranty20. Would someone please explain how to do that?
benton is offline  
Reply With Quote