PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




func_get_args

Name

func_get_args — Gets an array of all arguments passed to a function.

Synopsis

array func_get_args(void)

Returns

Array containing all of the arguments passed to a function; FALSE if func_get_args() is called in global scope

Description

func_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.

Note

Unlike 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.

Version

PHP Version: 4.0b4+

Example

Example 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.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.