PHP options for extracting data from an array?
<p>Given this two-dimensional array,  each element has two indexes – row and column.</p>

<pre><code>&lt;?php
$shop = array( array("rose", 1.25 , 15),
               array("daisy", 0.75 , 25),
               array("orchid", 1.15 , 7) 
             ); 
?&gt;
</code></pre>

<p>Are these my only two options for extracting the data from the array, using row and column indexes?</p>

<pre><code>&lt;?php
echo "&lt;h1&gt;Manual access to each element&lt;/h1&gt;";

echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."&lt;br /&gt;";
echo $shop[1][0]." costs ".$shop[1][1]." and you get ".$shop[1][2]."&lt;br /&gt;";
echo $shop[2][0]." costs ".$shop[2][1]." and you get ".$shop[2][2]."&lt;br /&gt;";

echo "&lt;h1&gt;Using loops to display array elements&lt;/h1&gt;";

echo "&lt;ol&gt;";
for ($row = 0; $row &lt; 3; $row++)
{
    echo "&lt;li&gt;&lt;b&gt;The row number $row&lt;/b&gt;";
    echo "&lt;ul&gt;";

    for ($col = 0; $col &lt; 3; $col++)
    {
        echo "&lt;li&gt;".$shop[$row][$col]."&lt;/li&gt;";
    }

    echo "&lt;/ul&gt;";
    echo "&lt;/li&gt;";
}
echo "&lt;/ol&gt;";
?&gt;
</code></pre>
