Re: php4 objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robby Russell wrote:

A friend of mine asked me if I knew if this was possible in PHP4.


class foo { var $bar = NULL;

   function foo()
   {
       $this->bar = new bar();
   }

   function getBar()
   {
       return $this->bar;
   }

}


class bar { var $thing = NULL;

   function bar()
   {
       $this->thing = "Hello World!";
   }

   function getThing()
   {
       return $this->thing;
   }

}


he wants to do something like this:

$obj =& new foo;

print $foo->getBar()->getThing();

is this possible in PHP4?

I know that he can do a:

print $obj->bar->getThing();

..but he wants it to run some stuff in the functions that he is calling
and wants to do it in one command if possible.

-Robby




No, he can't. That functionality WAS added in PHP 5 though.

Chris

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux