Q:

Foreach loop, using key identifers in one single array

I am using key identifers in my foreach loop in order to control how I echo strings next to the data. For example
The array 
  $array = array("name" => "Jim", "age" => 34);

array(2) {
  ["name"]=> string(3) "Jim"
  ["age"]=>  int(34)
}

The loop
<?php
 foreach ($array as $value) {

  echo "Name " .$value["name"]."</br>
    Age ".$value["age"] . "</br>";

 }
?>

The output I get
Name J
Age J
Name
Age 

The desired result 
Name Jim 
Age 34

A:

Why are you using the foreach functionality? If you remove that you will get exactly what you want. And you will change $value to $array.

