Created
March 30, 2012 17:37
-
-
Save piercemoore/2253239 to your computer and use it in GitHub Desktop.
Handling unlimited/variable function arguments
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
| 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