I get this array, but I want to show me KEY and all subitem of that KEY bellow, I dont want every time to repear a key, I need that key shows only one and all others entity that has same key under this one.
array(2) {
[0]=>
array(1) {
["A"]=>
string(2) "Test1"
}
[1]=>
array(1) {
["A"]=>
string(2) "Test1"
}
}
I want something like this:
array(2) {
[0]=>
array(1) {
["A"]=>
string(2) "Test1",
string(2) "Test2"
}
}
use the following:
$return = array_merge_recursive($array, ...);
in your case:
$return = array_merge_recursive($array[0], $array[1]);
but I am guessing you'll want a more dynamic solution, I will draft that up now.
$return = call_user_func_array('array_merge_recursive', $array);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.