Welcome Guest, Not a member yet? Register   Sign In
array_merge() is messing with my array keys.
#4

[eluser]xwero[/eluser]
Fuzzy sight too Wink i wrote array_push : Push one or more elements onto the end of array.

But with array_merge the reindexing of the keys happens too with multiple arrays if you check out the example on the page
Code:
<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>

/*The above example will output:

Array
(
    [color] => green
    [0] => 2
    [1] => 4
    [2] => a
    [3] => b
    [shape] => trapezoid
    [4] => 4
)*/


Messages In This Thread
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 06:24 AM
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 06:38 AM
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 06:49 AM
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 07:03 AM
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 07:08 AM
array_merge() is messing with my array keys. - by El Forum - 10-02-2008, 07:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB