PHP » GoLang |
login |
register |
about
|
func_get_args(PHP 4, PHP 5, PHP 7) func_get_args — Returns an array comprising a function's argument list Description
array func_get_args
( void
)
Gets an array of the function's argument list. This function may be used in conjunction with func_get_arg() and func_num_args() to allow user-defined functions to accept variable-length argument lists. Return ValuesReturns an array in which each element is a copy of the corresponding member of the current user-defined function's argument list. Changelog
Errors/ExceptionsGenerates a warning if called from outside of a user-defined function. Examples
Example #1 func_get_args() example
<?php The above example will output: Number of arguments: 3 Second argument is: 2 Argument 0 is: 1 Argument 1 is: 2 Argument 2 is: 3
Example #2 func_get_args() example before and after PHP 5.3
test.php Output previous to PHP 5.3: array ( 0 => 'First arg', 1 => 'Second arg', ) Output in PHP 5.3 and later: Warning: func_get_args(): Called from the global scope - no function context in /home/torben/Desktop/code/ml/fga.inc on line 3 false
Example #3 func_get_args() example of byref and byval arguments
<?php Output of the above example in PHP 7: As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', ) As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', ) Output of the above example in PHP 5: As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'bar', ) As passed : array ( 0 => 'bar', ) After change : array ( 0 => 'baz', ) Notes
|
more
Recently updated
more
Most requested
more
Last requests
|