I know this is an old question, but my Google search for “php array default values” took me here, and I thought I would post the solution I was looking for, chances are it might help someone else.
I wanted an array with default option values that could be overridden by custom values. I ended up using array_merge.
Example:
<?php
$defaultOptions = array("color" => "red", "size" => 5, "text" => "Default text");
$customOptions = array("color" => "blue", "text" => "Custom text");
$options = array_merge($defaultOptions, $customOptions);
print_r($options);
?>
Outputs:
Array
(
[color] => blue
[size] => 5
[text] => Custom text
)