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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OlKgaW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire