Created
July 14, 2013 19:28
-
-
Save peterwang/5995503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// cascading configurations via | |
// merging with defaults options | |
$defaults = array( | |
'foo' => 'bar', | |
'baz' => 'qux', | |
'quux' => 'fred', | |
); | |
$option1 = array( | |
'foo' => 'abc', | |
'abc' => 'def', | |
); | |
$option2 = array( | |
'baz' => 'xyz', | |
'abc' => '123', | |
); | |
$options = array_merge($defaults, $option1, $option2); | |
print_r($options); | |
/* | |
Array | |
( | |
[foo] => abc | |
[baz] => xyz | |
[quux] => fred | |
[abc] => 123 | |
) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment