Merge two arrays as key value pairs in PHP -
i've got 2 arrays of same size. i'd merge 2 values of 1 key indexes of new array, , values of new array values of other.
right i'm looping through arrays , creating new array manually, have feeling there more elegant way go this. don't see array functions purpose, maybe missed something? there simple way along these lines?
$mapped_array = mapkeys($array_with_keys, $array_with_values);
see array_combine()
on php.net.
Comments
Post a Comment