note 46569 deleted from function.func-get-args by aidan
| From: | aidan@php.net | Date: | Sat, 16 Oct 2004 04:50:10 +0000 |
| Subject: | note 46569 deleted from function.func-get-args by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78641@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. */
//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);
----
Reason: bad code