Say I have an array like this:
$result=array("1", "2", "34");
And I have another array:
$keys=array("id", "price", "day");
As it is, $result
has numeric keys for each of its values. I want to add to those values associative keys, using the values in $keys
as such, but without deleting the numeric keys. That is, I want the result to be:
array(6)
{ [0]=> string(1) "1"
[1]=> string(1) "2"
[2]=> string(2) "34"
["id"]=> string(1) "1"
["price"]=> string(1) "2"
["day"]=> string(2) "34"
}
I know that I could write a itty-bitty function to do this by hand, but is there any built-in function, among the myriad ones in PHP, to do this automatically? (My PHP knowledge is a bit rusty).