note 46570 deleted from function.func-get-args by tularis
| From: | tularis@php.net | Date: | Fri, 15 Oct 2004 19:46:12 +0000 |
| Subject: | note 46570 deleted from function.func-get-args by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78604@lists.php.net to get a copy of this message | ||
Note Submitter: lyon at NOSPAM dot gehlingpainters dot com
----
If you use a dynamic number of arguements in fuction calls func_get_arg() will generate a warning,
crying about undefined arguements. Ex. using subfunctions. Use funct_get_args in the following
manner to get around it.
<?php
//defined function
function my_funct() {
$funct_args = func_get_args();
isset($funct_args[0]) ? $arg1 = $funct_args[0] : $arg1 = NULL;
isset($funct_args[1]) ? $arg2 = $funct_args[1] : $arg2 = NULL;
isset($funct_args[2]) ? $arg3 = $funct_args[2] : $arg3 = NULL;
if(isset($arg1))
print "Arguement 1 is present";
if(isset($arg2))
print "Arguement 2 is present";
if(isset($arg3))
print "Arguement 3 is present";
}
//function call
my_funct($passed_arg1, $passed_arg2);
?>