PHP » PYTHON |
login |
register |
about
|
PYTHON func_get_args
is this article helpful?
|
Python replacement for PHP's func_get_args
[
edit
| history
]
def foo(*args): # just use "*" to collect all remaining arguments into a tuple numargs = len(args) print "Number of arguments: %s<br />" % numargs if numargs >= 2: print "Second argument is: %s<br />" % args[1] for i, x in enumerate(args): print "Argument %d is: %s<br />" % (i, x) func_get_args(PHP 4, PHP 5) 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
Notes
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|