/ Published in: PHP
                    
                                        
Take an associative array of options and their default settings. Remove entries of options that do not exist in the default options. Return a safely filtered and overridden array of options.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?php
'default' => 'options',
'and' => 'values',
'go' => 'here',
'required' => true,
'filter_function' => null,
'error_string' => 'An error occurred: %s'
),
$options
),
$defaults
)
);
// Function Version
/**
* Takes an associative array of options and their default settings.
* Removes entries of options that do not exist in the defaults.
* Returns an array of options with the defaults where options do not
* override the defaults.
* @param array $options The user's options
* @param array $defaults The default options
* @return array The filtered and overridden options
*/
function safe_options ($options, $defaults) {
}
$options,
array (
'default' => 'options',
'and' => 'values',
'go' => 'here',
'required' => true,
'filter_function' => null,
'error_string' => 'An error occurred: %s'
)
));
print $default.$and.$go.$required.$filter_function.$error_string;
?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                