func_get_argsReturnsArray containing all of the arguments passed to a function; FALSE if func_get_args() is called in global scope Descriptionfunc_get_args() returns an array containing the list of arguments passed to a user-defined function. Like func_get_arg() , this function allows the programmer to easily create functions that accept variable-length argument lists. NoteUnlike most functions, func_get_args() cannot always be used as an argument for some functions. It's better to assign the output of func_get_args() to a variable and then use the variable as the argument for a function. ExampleExample 381. Demonstrate how func_get_args() works function demo () { $num_args = func_num_args (); if ($num_args == 0) { print "The function was passed no arguments.<br /><br />"; return; } print "The function was passed $num_args argument(s): <blockquote>"; $args = func_get_args (); foreach ($args as $offset => $value) printf ('Argument %d (Offset %d): %s<br />', $offset +1, $offset, $value); print '</blockquote><br />'; } demo (); demo ('Mango Chutney'); demo ('Chutneys', 'Mint', 'Mango', 'Coriander', 'Ginger'); demo ('Yummy East Indian Meal', array ('Chutney' => 'Mint', 'Bread' => 'Chappati')); // Chutney (Anglicized version of the Hindi word catni) // A chutney is a delectable and pungent relish of fruits, spices and herbs. // Interestingly, the Hindi word for chutney is derived from the Hindi verb for // 'to taste'.
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|