I have a multidimensional array and I\'m trying to find out how to simply \"echo\" the elements of the array. The depth of the array is not known, so it could be deeply nest
There are multiple ways to do that
1) - print_r($array); or if you want nicely formatted array then
echo ''; print_r($array); echo '';
//-------------------------------------------------
2) - use var_dump($array) to get more information of the content in the array like datatype and length.
//-------------------------------------------------
3) - you can loop the array using php's foreach(); and get the desired output.
function recursiveFunction($array) {
foreach ($array as $val) {
echo $val['comment_content'] . "\n";
recursiveFunction($vals['child']);
}
}