mardi 26 novembre 2019

Combine array and add key for each array

I just can't find the right question for this

pretty much merging array From this

$arr1 = ["temp1", "temp2", "temp3"];
$arr2 = [5, 7, 2];

to this

$combined = [["name" => "temp1", "number" => 5], ["name" => "temp2", "number" => 7], ["name" => "temp3", "number" => 2]];

any idea to do it in most efficient way other than foreach?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire