Re: allow_call_time_pass_reference?
| From: | Armand Turpel | Date: | Sat, 30 Aug 2003 19:23:47 +0000 |
| Subject: | Re: allow_call_time_pass_reference? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161266@lists.php.net to get a copy of this message | ||
Thanks for this clarification!
atu
----- Original Message -----
From: "Curt Zirzow" <php-general@zirzow.dyndns.org>
To: <php-general@lists.php.net>
Sent: Saturday, August 30, 2003 6:10 PM
Subject: Re: [PHP] allow_call_time_pass_reference?
> * Thus wrote Armand Turpel (armand@a-tu.net):
> > Why allow_call_time_pass_reference is deprecated? I mean it should be
the
> > choice of the programmer to make use of pass by reference or not.
> >
> > Example:
> >
> > $this_string = $is_really_big // lets say 500 kb
> >
> > function ($this_string){} // Here the function takes a copy of
$this_string
> > (500 kb) -> in php4
> >
> > function (& $this_string){} // Here the function takes only the address
of
> > $this_string (I guess an int value)
> >
> > Make use of the second function is less memory intense. So again. Why
this
> > feature should be deprecated? And why (the nonsens!) to give hostmasters
the
> > possibility to switch this off in the php.ini?
>
> You aren't understanding what that flag does:
>
> <php.ini>
> ; - allow_call_time_pass_reference = Off [Code cleanliness]
> ; It's not possible to decide to force a variable to be passed by
reference
> ; when calling a function. The PHP 4 style to do this is by making
the
> ; function require the relevant argument by reference.
> </php.ini>
>
> This flag does not apply to what you have above. What this disables
> is the ablity to decide at 'call time', of the function, to pass by
> reference or not. This was an old method and changed in php 4:
>
>
> function foo($bar) { }
> foo(&$mybar); // this is what it doesn't allow.
>
>
> It is up to the function to declare if you want to pass by
> reference or not, this is not depricated:
>
> function foo_reference(&$bar) { }
> function foo_copy($bar) { }
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>