displaying the content of an array which is composed of two other arrays
i have an array like this :
$finalArray= array($array1, $array2);
later, how should i do to display the content of $fin开发者_如何学PythonalArray
in a loop without knowing the name of the columns of $array1
and $array2
? thx in advance :)
EDIT i.e : to display the content of a simple array we do something like that :
foreach($array1 as $value){
echo $value['the_name_of_the_columns']."<br />";
}
how about an array of arrays :), i'm supposed to having to know the name of columns, i need to it independently on the columns names .
use foreach....
echo "first: <br/>";
foreach ($finalarray[0] as $value) {
echo "Value: $value<br />\n";
}
echo "second: <br/>";
foreach ($finalarray[1] as $value) {
echo "Value: $value<br />\n";
}
EDIT :
documentation on foreach: http://php.net/manual/en/control-structures.foreach.php
精彩评论