I have the arrays :
$tamanho = ['P', 'M', 'G'];
$quantidade = [1, 3, 5];
The end result would have to look like this:
$final = [
["tamanho" => 'P', "quantidade" => 1],
["tamanho" => 'M', "quantidade" => 3],
["tamanho" => 'G', "quantidade" => 5]
];
I thought about using array_merge
, but it returns me this:
{"P":"1","M":"3","G":5}
And I need the "size" and "quantity" indexes, as I will use a foreach
to insert this data into the database, so I need to specify the data type.