Last active
August 29, 2015 13:57
-
-
Save peteboere/9829995 to your computer and use it in GitHub Desktop.
Named arguments in PHP 5.4
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
<?php | |
function named_args($required, $options = []) | |
{ | |
extract($options + [ | |
'option_one' => false, | |
'option_two' => true, | |
'option_three' => 100, | |
]); | |
if ($option_one) { | |
// Code... | |
} | |
} | |
named_args('foo.csv', ['option_one' => true]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment