note 67275 deleted from language.references.pass by bjori
| From: | bjori@php.net | Date: | Tue, 06 Jun 2006 21:30:20 +0000 |
| Subject: | note 67275 deleted from language.references.pass by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-113380@lists.php.net to get a copy of this message | ||
Note Submitter: keyvez at hotmail dot com
Reason: in docs
----
PHP has deprecated call-time pass-by referenc, which means that you should not do something like
this
<?php
function addFive($Number) {
$Number = $Number + 5;
}
$Number = 2;
addFive(&$Number);
echo $Number;
?>
Even though the above code will work, it will throw a warning about call-time pass-by ref. being
deprecated.
There are several ways to get around it:
1. Modify the function definition of
<?php
function addFive($Number) {
$Number = $Number + 5;
}
?>
to
<?php
function addFive(&$Number) {
$Number = $Number + 5;
}
?>
Notice the & (ampersand) before $Number.
PHP.net doesn't allow very long posts so read the rest here for one more method
http://www2.keyvez.com:82/?q=node/16
Gaurav Misra