Created
September 1, 2011 09:01
-
-
Save jaysn/1185752 to your computer and use it in GitHub Desktop.
returns a standartized array following the scheme of $defaul_pairs(accepted_field => default_value) inserting the values of $atts if the field exists in $default_pairs
This file contains hidden or 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
function att_array_combine($default_pairs, $atts) { | |
$atts = (array)$atts; | |
$combined = array(); | |
foreach($default_pairs as $name => $default) { | |
if ( array_key_exists($name, $atts) ) | |
$combined[$name] = $atts[$name]; | |
else | |
$combined[$name] = $default; | |
} | |
return $combined; | |
} |
This file contains hidden or 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
function att_array_combine($default_pairs, $atts) { | |
$atts = (array)$atts; | |
$combined = array(); | |
foreach($default_pairs as $name => $default) { | |
if ( array_key_exists($name, $atts) ) | |
$combined[$name] = $atts[$name]; | |
else | |
$combined[$name] = $default; | |
} | |
return $combined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment