Forum Moderators: coopster
array(5) {
["bus_id"]=>
string(3) "117"
["map_id"]=>
string(2) "33"
["description"]=>
string(5) "hours"
["text"]=>
string(13) "this is hours"
["image"]=>
string(0) ""
}
and I would like to turn them into this:
array(
. .'54'=>array(
. . .["bus_id"]=>
. . ."117"
. . .["map_id"]=>
. . ."54"
. . .["description"]=>
. . ."children code"
. . .["text"]=>
. . ."children must be out by 8pm"
. . .["image"]=>
. . .""
. . .),
. .'33'=>array(
. . .["bus_id"]=>
. . ."117"
. . .["map_id"]=>
. . ."33"
. . .["description"]=>
. . ."hours"
. . .["text"]=>
. . ."this is hours"
. . .["image"]=>
. . .""
. . .)
);
clear as mud? thank you.
If I'm reading it correctly, you wanted to take the two arrays and make them two elements of a new array, keyed on map_id of the old arrays. Something like the following would do that:
$array_final = array($array1['map_id'] => $array1, $array2['map_id'] => $array2);