note 24415 deleted from function.compact by et
| From: | et@php.net | Date: | Sat, 31 Jan 2004 15:05:37 +0000 |
| Subject: | note 24415 deleted from function.compact by et | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64479@lists.php.net to get a copy of this message | ||
Note Submitter: marc.webb@sinclair.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.