array(2) {
[0]=>
array(4) {
["id"]=>
string(1) "1"
["name"]=>
string(3) "Lim"
["subproject_id"]=>
string(1) "5"
["subproject_name"]=>
string(4) "Mads"
}
[1]=>
array(1) {
[0]=>
array(4) {
["id"]=>
string(1) "1"
["name"]=>
string(3) "Lim"
["subproject_id"]=>
string(1) "4"
["subproject_name"]=>
string(5) "KANYE"
}
}
}
How can I output each name and subproject_name?
A simple foreach() will only get the first one.
Try this:
See http://php.net/manual/en/function.array-walk-recursive.php
Note: for PHP 5.3.0 you can use callback, in earlier versions you need non-anonymous function.