It's not the same thing. When an variable references an object then you can change either the original object or the new variable and you will be changing the *same* object, not a new one. Maybe this example helps?

<?php

    class test {
        function test($val) {
            global $myref;
            $myref = &$this;
            $this->value = $val;
        }
        function printval() {
            echo "The value of this class is '{$this->value}' <br>";
        }
        function setval($val) {
            $this->value = $val;
        }
    }

$a = new test();
$b = &$a;
$c = new test();

$a->setval(22);
$b->setval(321);
$c->setval('A weird comment');

$a->printval(); // should see 321
$b->printval(); // should see 321
$c->printval(); // should see A weird comment

?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to