I'm trying to combine some arrays, but it keeps picking an empty value and making that part of the array.
For example, the original array looks like this:
Array ( [order] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => [6] => [7] => [8] => [9] => [10] => ) [ids] => Array ( [0] => 4857 [1] => 4877 [2] => 4861 [3] => 4881 [4] => 4893 [5] => 4872 [6] => 4873 [7] => 4862 [8] => 4903 [9] => 4874 [10] => 4880 )
I'm trying to combine the [order] and [ids] array so that I get this:
Array ( [1] => 4857 [2] => 4877 [3] => 4861 [4] => 4881 [5] => 4893 )
But, I keep getting this:
Array ( [1] => 4857 [2] => 4877 [3] => 4861 [4] => 4881 [5] => 4893 [] => 4880 )
Since I'm not using PHP5, I'm using a custom function that looks like this:
if (! function_exists('array_combine')) {
function array_combine($keys, $values) {
foreach($keys as $key) $out[$key] = array_shift($values);
return $out;
}
}
Can anyone explain to me why this is happening and how to correct it? Thanks!