Created
February 28, 2013 10:28
-
-
Save jbrooksuk/5055761 to your computer and use it in GitHub Desktop.
PHP named arguments hack
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 | |
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