Skip to content

Instantly share code, notes, and snippets.

@Johnicholas
Created August 19, 2015 18:09
Show Gist options
  • Save Johnicholas/012ab7a5ccd81900259b to your computer and use it in GitHub Desktop.
Save Johnicholas/012ab7a5ccd81900259b to your computer and use it in GitHub Desktop.
<?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