Re: Passing by reference deprecated?
| From: | Yasuo Ohgaki | Date: | Fri, 30 Mar 2001 09:07:44 +0000 |
| Subject: | Re: Passing by reference deprecated? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46267@lists.php.net to get a copy of this message | ||
FYI
Unless you need to modify and return modified contents of variables, pass by
reference makes script execution a little slower under PHP4.
--
Yasuo Ohgaki
""Neil Kimber"" <neil.kimber@flytxt.com> wrote in message
news:OAEEKIKEIHKOPGHNDHJJIEJACOAA.neil.kimber@flytxt.com...
> Pass by reference itself is not deprecated, just call-time
> pass-by-reference.
> I believe this means your calling line of code being prevented from
> specifying that it should be invoked as pass-by-reference.
>
> So,
>
>
> function NormalPassByRefence(&$prmValue)
> {
> $prmValue ++;
> }
>
> $numValue=1;
> NormalPassByRefence($numValue); // This will still work
> // $numValue =2 at this point
>
>
> function CallTimePassByRefence($prmValue)
> {
> $prmValue ++;
> }
>
> $numValue=1;
> CallTimePassByRefence(&$numValue); // This will no longer work - it's been
> deprecated
> // $numValue =1 at this point
>
>
>
>
> -----Original Message-----
> From: CC Zona [mailto:cczona@nospam.invalid]
> Sent: 30 March 2001 04:40
> To: php-general@lists.php.net
> Subject: [PHP] Passing by reference deprecated?
>
>
> set_value(&$variable,$value)
> {
> $variable=value;
> }
>
> "Warning: Call-time pass-by-reference has been deprecated - argument passed
> by value; If you would like to pass it by reference, modify the declaration
> of [runtime function name](). If you would like to enable call-time
> pass-by-reference, you can set allow_call_time_pass_reference to true in
> your INI file. However, future versions may not support this any longer. "
>
> When did passing by reference get deprecated? The documentation at
> <http://php.net/manual/en/language.references.pass.php>
> doesn't suggest
> what to do instead--in fact, it uses an example like the syntax above. So
> my next question is: would using a return value or declaring a global be
> the (only) other options?
>
> TIA
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>