unset() and php4b4
| From: | Michal Kolodziejczyk | Date: | Thu, 02 Mar 2000 14:45:32 +0000 |
| Subject: | unset() and php4b4 | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11340@lists.php.net to get a copy of this message | ||
Hello,
I have a problem with unset() function, which behaves differently for php3
and php4b4. In php4 it dereferences variable (if it is passed to function
by reference) instead unsetting() referenced variable. Is it a bug or
known incompatibility?
Here is the script:
<?
function change(&$data) {
unset($data);
$data = 'new value';
};
$data='old value';
echo "Before change: $data";
change($data);
echo "After change: $data";
?>
For php4 I get 'old value' twice.
Michal
--
_/ _/ _/_/_/ ----- Michal Kolodziejczyk, miko@wp.pl -----
_/ _/ _/ _/ _/ Wirtualna Polska SA http://www.wp.pl
_/_/_/_/ _/_/_/ ul. Uphagena 2, 80-237 Gdansk, tel/fax. (58) 520-22-47
_/ _/ _/ --------==* Moja WP: http://moja.wp.pl
*==----------