hi all,
is it possible to somehow have a function which takes a variable number
of arguments (with some kind of key association) which can then be
converted to variables?
i am sick of continually having to go back and add empty parameters to
functions in use.
an example would be..
function test1()
{
extract(func_arg_keys());
print $this;
}
test1($test = 1, $this = 2);
// output
2
i know something similar can be done like this...
function test2()
{
extract($arr);
print $this;
}
test2($arr = array(
"test" => 1,
"this" => 2
));
// output
2
is there another ... better or cleaner way?
having something like this inbuilt into php would appear to be an
excellent to allow functions to easily expand without having to go
revisit already used instances of the function
many thanks
christian
ps sorry if this has been discussed before
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- [PHP] Re: variable num of function args christian haines
- [PHP] Re: variable num of function arg... christian haines
- RE: [PHP] variable num of function arg... Ford, Mike [LSS]