note 24416 deleted from function.extract by aidan
| From: | aidan@php.net | Date: | Thu, 09 Sep 2004 09:14:45 +0000 |
| Subject: | note 24416 deleted from function.extract by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76294@lists.php.net to get a copy of this message | ||
Note Submitter: marc dot webb at sinclair dot edu
----
If you ever want to get lazy when passing variables to functions, you might
try this procedure which dumps all defined variables into one array,
passes the one array to a function and splits it back into the original
variables:
function my_function($all_vars)
{
extract($all_vars);
//meat of function
}
$all_vars=get_defined_vars();
my_function($all_vars);
This is a lot easier than passing 10 arguments and having to type them for
the function definition and all the function calls in your program.
This also helps if you generate variable numbers of arguments, haven't
planned ahead for them, and the beta code is due by 5:00.