Hi!

        I'm having some goofy interactions between $this pointers in 
classes and variables.

        Case in Point:

        if I have the following code:

<?php
class Y
{
    var $children;

    function addValue($in_value)
    {
        $this->children[] = $in_value;
    }

    function Y()
    {
    }

    function Zabba()
    {
        $this->addValue("asdfasdfasdf");
    }
}



$abc = new Y();
$abc->Zabba();
var_dump($abc->children);
?>


        I will correctly get on output, an array with one item in it.

        However, if I Change the Zabba function to:


        function Zabba()
        {
            $localVariable = $this;
            $localVariable->addValue("asdfasdfasdf");
        }

        Then I will get on output, a NULL array.

        Why is this?  Is there any particular reason this happens?

        thanks,
        mark.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to