Created
August 25, 2011 17:56
-
-
Save johndwells/1171300 to your computer and use it in GitHub Desktop.
Interset & merge an array of settings, discarding invalid keys
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 | |
$default_settings = array( | |
'setting1' => '', | |
'setting2' => '' | |
); | |
// assuming $settings has been passed | |
// interset & merge with defaults | |
$settings = array_merge($default_settings, array_intersect_key($settings, $default_settings)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment