[PHP-DEV] arrays of objects From: Stephanie Wehner (_ <email protected>)
Date: 02/03/00

Hi,

Is this a known 'feature' or a bug ? If I have an array of objects and I want
to change some variable in one of them, then this seems to work only temporarily:

<?
        class Foo{

                var $test = "test1";

                function assignTest($string) {
                        $this->test = $string;
                }

        }

        $testing = new Foo;
        echo "$testing->test<br>";

        $some_array[0] = $testing;
        $tmp = $some_array[0];
        $tmp->assignTest("test2");
        echo "$tmp->test<br>";

        $tmp2 = $some_array[0];
        echo "$tmp2->test<br>";

?>

This will print test1,test2,test1 . This would not be that annoyind cause I can
do $some_array[0]->assignTest("foo") as well. However if I would do that in a class
then things become a problem since I can't do $this->foo->bar() for example.

Is there a way how this can still be done ? Or is it simply a bug ?

bye,
 <email protected>
----------------------------<> _ <email protected> <>-----------------<> FreeBSD <>---
        "I had to hit him -- he was starting to make sense."

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>