Hi, the best way to know what index contains what is to print that array using print_r or var_dump...
print_r($ThirdArray);
or
var_dump($ThirdArray);
Note: If you are printing this in an HTML file, then use the <PRE> tag to align the output correctly..
echo "<PRE>";
print_r($ThirdArray);
echo "</PRE>";
Using this, you can see the contents of $_POST, $_GET variables, arrays or other variables.
---
Harish
Main Topics
Browse All Topics





by: BogoJokerPosted on 2006-05-06 at 20:42:58ID: 16623715
Hi GiantMatrix,
a']; 2'][0]['a' ];
Here is an example.
<?php
$FirstArray = array();
array_push($FirstArray, array(
'a' => "A",
'b' => "B"
));
$SecondArray = array();
array_push($SecondArray, array(
'a2' => $FirstArray,
'b2' => "B2"
));
$ThirdArray = array();
array_push($ThirdArray, array(
'a3' => $SecondArray,
'b3' => "B3"
));
print_r($ThirdArray);
print '<br>';
print $FirstArray[0]['a'];
print '<br>';
print $SecondArray[0]['a2'][0]['
print '<br>';
print $ThirdArray[0]['a3'][0]['a
?>
Your nesting a lot of arrays inside arrays, and because some of them you don't give an associated index, they default to 0 (then 1, 2, 3....)
The bottom three will all print: A
Joe P