Hi, Use & to reference one variable to another!
$b =& $a; Lars -----Original Message----- From: Lucijan [mailto:[EMAIL PROTECTED]] Sent: 21 March 2002 10:20 To: [EMAIL PROTECTED] Subject: [PHP] Object reference I can't understand why this works like it does. class MyObj { var $Name; function MyObj($Name) { $this->Name = $Name; } } $a = new MyObj('MyObjName'); $b = $a; $b->Name = 'NoName'; echo $a->Name; Last line will output 'MyObjName' instead of 'NoName' (like I was expecting) I'd expect $a and $b to behave like reference pointers (change in $b is reflected in $a and vice versa) instead of copiing $a to $b (beiing a Delphi programmer this is as natural to me as the Sun raising in east and setting in west :-) So, is there a way to do this; pointers or something maybe? Lucijan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php