RE:passing references multiple levels of function calls
| From: | Dennis Gearon | Date: | Tue, 22 May 2001 23:37:49 +0000 |
| Subject: | RE:passing references multiple levels of function calls | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53957@lists.php.net to get a copy of this message | ||
ooops, had a typo, sorry ......
Dennis Gearon wrote:
>
> I want to be able to do this:
>
> function f_of_A( &$vara ){
> $var +=1;
> }
>
> function f_of_B( &$varb ){
> $var %=3;
> }
>
> function do_both( &$vara, &$varb ){
> f_of_A( $vara );
> f_of_B( $varb );
> }
>
> $gvara=some_number;
> $gvarb=some_other_number;
>
> do_both( $gvara, $gvarb );
>
> and have the original, global variables altered by the 'f_of_X'
> functions.
>
> The above structure and use of the '&' symbol DID NOT WORK, any ideas
> why the
> reference to the real contents did not get passed down?