Re: Question on PHP func_get_arg function.
| From: | Gabor Hojtsy | Date: | Wed, 18 Sep 2002 10:33:07 +0000 |
| Subject: | Re: Question on PHP func_get_arg function. | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-12620@lists.php.net to get a copy of this message | ||
Please submit feature requests at the bug system in the feature request category.
Thanks,
Goba [one webmaster@php.net]
----- Original Message -----
From: Manuel Vázquez Acosta
To: webmaster@php.net
Sent: Tuesday, September 17, 2002 9:55 PM
Subject: Question on PHP func_get_arg function.
Does PHP team work has the idea of extending func_get_arg functionality so it can return a
reference?
I mean something like this:
function myfunc(){
$arg =& func_get_arg(0); // Trying to obtain a reference
}
$res = myfunc( &$obj ); // This outputs a warning
Of course this set us back to old-style reference passing, but could make some good.
Since we can pass references as:
function myf( &$a ) {
}
It seems not big deal to have this feature of passing references through func_get_arg(), unless
you want to pass a not previously known number of reference. The way around this could be passing a
reference to an array: myf(list($a, $b, $c)), but gets code more obscure.
As the only way of not knowing how a parameter must be passed(copy or reference) to a function is
when it is not present in function definition, one way of handle this is pass them all as reference
so the real copy gets done when the needed func_get_arg call is made, unless the asignation goes
with & operator when no copy is done.
My question goes then this way: is it too hard to make things behave like this?
Manuel.