Eval and Multidimensional arrays - wont output the value
Posted: Fri Dec 15, 2006 10:18 pm
I am building a subnav and I cant get eval to echo out the value.
I can get the following to work:
However if I do
all I get is:
Here is a bigger snippet of my code
I cant see why this isnt working 
I can get the following to work:
Code: Select all
eval("return \$subnav_array;")Code: Select all
echo '<strong>' . eval("return \$subnav_array[0][0];") . '</strong>';Code: Select all
<strong></strong>Here is a bigger snippet of my code
Code: Select all
if ($nav_array[$row][2] != '')
{
$subnav_array = "$".$nav_array[$row][2];//get the name of the subnav array
$num_in_subnav = eval("return count($subnav_array);");
echo '<strong>'.$num_in_subnav.'</strong><br />';//DEBUG
echo 'subnav array name= <strong>' .eval("return \$subnav_array;") . '</strong>';//DEBUG
echo '<strong>' . eval("return \$subnav_array[0][0];") . '</strong>';//DEBUG
echo '<ul>';
for ($subrow = 0; $subrow < $num_in_subnav; $subrow++)
{
echo '<li><a href="' . eval("return \$subnav_array[$subrow][0];") . '">' . eval("return \$subnav_array[$subrow][1];") . '</a></li>';
}
echo '</ul>';
}