Foreach loop + associative array
<p>If I have the following code:</p>

<pre><code>$employeeAges;
$employeeAges["Lisa"] = "28";
$employeeAges["Jack"] = "16";
$employeeAges["Ryan"] = "35";
$employeeAges["Rachel"] = "46";
$employeeAges["Grace"] = "34";

foreach( $employeeAges as $name =&gt; $age){
    echo "Name: $name, Age: $age &lt;br /&gt;";
}
</code></pre>

<p>How can I output specific information? Below is a wrongly written example:</p>

<pre><code>foreach( $employeeAges as $name =&gt; $age ) {
     $selective = $name["Lisa"]-&gt;$age;
     $secondary = $name["Grace"]-&gt;$age;
     echo "The person you're looking for is $selective years old. And the other one is $secondary years old.";
}
</code></pre>

<p>As you see, I want to grab only the $value of specifics $key. The code above output the following error:</p>

<pre><code>Trying to get property of non-object 
</code></pre>

<p>Can someone please help with this piece of code? Greatly appreciated.</p>
