update page now
Longhorn PHP 2026 - Call For Papers

Voting

: seven minus six?
(Example: nine)

The Note You're Voting On

atul dot kr_singh at hotmail dot com
13 years ago
If an associative array is used as the second parameter of array_fill_keys, then the associative array will be appended in all the values of the first array.
e.g.
<?php
$array1 = array(
    "a" => "first",
    "b" => "second",
    "c" => "something",
    "red"
);

$array2 = array(
    "a" => "first",
    "b" => "something",
    "letsc"
);

print_r(array_fill_keys($array1, $array2));
?>

The output will be
Array(
    [first] => Array(
        [a] => first,
        [b] => something,
        [0] => letsc
    ),
    [second] => Array(
        [a] => first,
        [b] => something,
        [0] => letsc
    ),
    [something] => Array(
        [a] => first,
        [b] => something,
        [0] => letsc
    ),
    [red] => Array(
        [a] => first,
        [b] => something,
        [0] => letsc
    )
)

<< Back to user notes page

To Top