I am writing a small framework for myself to help build my site, my current example is an object function to start an HTML page, it will be ran like this:
$page->head(array(
'doctype' => 'html4',
'description' => 'My page'
//etc
));
I wish to have a default array (as defined in head()
) to have default values in case they are not defined. It may look like this:
$defaults = array('doctype' => 'html5', 'author' => 'default', ...);
What would be the best way to replace each default element with one defined in the head
function's arguments when called?
I found something maybe like this, being unsure of what it exactly does but it has the right idea http://www.php.net/manual/en/function.array-replace.php#94458