Skip to content

Instantly share code, notes, and snippets.

@piercemoore
Created March 30, 2012 17:37
Show Gist options
  • Select an option

  • Save piercemoore/2253239 to your computer and use it in GitHub Desktop.

Select an option

Save piercemoore/2253239 to your computer and use it in GitHub Desktop.
Handling unlimited/variable function arguments
function showAllArgs( $item1, $item2, $item3, etc...) {
$i = 0;
foreach( func_get_args() as $key => $val ) {
// $val is the value that you supplied to the parameter.
print "You supplied '$val' for argument #$i. \n";
$i++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment