Skip to content

Instantly share code, notes, and snippets.

@jbrooksuk
Created February 28, 2013 10:28
Show Gist options
  • Save jbrooksuk/5055761 to your computer and use it in GitHub Desktop.
Save jbrooksuk/5055761 to your computer and use it in GitHub Desktop.
PHP named arguments hack
<?php
namedArgsTest(array(
'one' => 'test',
'two' => 1,
'three' => 2
));
namedArgsTest();
function namedArgsTest(array $parameter = array()) {
$one = 'tripledes';
$two = 'ecb';
$three = null;
extract($parameter, EXTR_IF_EXISTS);
echo $one . " - " $two . " - " . $three . "<br />\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment