View Single Post
Old 06-28-2009, 08:05 PM   #5 (permalink)
benton
The Contributor
 
Join Date: Apr 2008
Posts: 78
Thanks: 0
benton is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
This should do it for you, amigo:
php Code:
foreach ($myArray as $key => $value)
{
    echo $key . ': ' . $value['id'] . ' - '.$value['text'] . '</br>';
}
That doesn't seem to do it but maybe I missing sometihng obvious. It I run the above, the output is
Quote:
warranty - -
So it got the array name but not the contents of that array. I then thought to try this:

PHP Code:
    foreach ($myArray as $key)
    {
      echo 
$key.'<br>';
      foreach (
$key as $value)
      echo 
$key ' - '$value['id'].' - '.$value['text'].'<br>';
    } 
But it doesn't get the name of the array. The output is
Quote:
Array
Array - 15 year - 15 Years
Array - 20 year - 20 Years
Array - 25 year - 25 Years
Is there a way to have both the array name and its contents printed?
benton is offline  
Reply With Quote