Created
August 19, 2015 18:09
-
-
Save Johnicholas/012ab7a5ccd81900259b to your computer and use it in GitHub Desktop.
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 | |
// a is not optional, b is optional, c is optional | |
function foo($a, $b = "b", $c = "c") | |
{ | |
// does something complicated | |
} | |
// I want to call foo with a set to "x", b set to default, and c set to "y", but foo("x", "y") isn't the right syntax. | |
// so I wrap foo, like this: | |
function bar($a, $c = "c") | |
{ | |
return foo($a, "b", $c) | |
} | |
// Now I can call bar("x", "y") and I get what I want | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment