note 30918 rejected from language.variables by alindeman
| From: | alindeman@php.net | Date: | Thu, 03 Apr 2003 12:26:36 +0000 |
| Subject: | note 30918 rejected from language.variables by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46164@lists.php.net to get a copy of this message | ||
I've PHP4 scripts and I need to make them work in PHP3.0.18
Any help?
For example:
//in PHP4
$VAR1=12;
function myfunc($VAR1)
{
$VAR1=5;
}
echo $VAR1;
it prints 5 in PHP4
instead in PHP3
it prints 12
It seems that PHP4 can pass variables by reference,
and PHP3 can't.
The solution for PHP3 is
//in PHP3
$VAR1=12;
function rw_msgopen()
{
global $VAR1;
$VAR1=5;
}
echo $VAR1;
it prints 5.
This sintax is also ok for PHP4?
bye