note 30918 added to language.variables
| From: | lamiaposta71 at hotmail dot com | Date: | Thu, 03 Apr 2003 09:39:39 +0000 |
| Subject: | note 30918 added to language.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46158@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
--
http://www.php.net/manual/en/language.variables.php
http://master.php.net/manage/user-notes.php?action=edit+30918
http://master.php.net/manage/user-notes.php?action=delete+30918
http://master.php.net/manage/user-notes.php?action=reject+30918