Re[2]: calling static method within class

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

 



Hi,

Saturday, October 29, 2005, 5:42:15 AM, you wrote:
CR> If you're expecting the statement 

CR> Echo Foo::getUs(); 

CR> To echo "me& me" it will not because you never returned $us from the
CR> getUs() method. I'm assuming also that xxx is a variable to mean "some
CR> class library" correct?

CR> Carlo Razzeto
CR> Programmer
CR> Mortgage Information Services
CR> Phone: (216) 514-1025 ex. 1212

CR> -----Original Message-----
CR> From: blackwater dev [mailto:blackwaterdev@xxxxxxxxx] 
CR> Sent: Friday, October 28, 2005 1:13 PM
CR> To: php-general@xxxxxxxxxxxxx
CR> Subject:  calling static method within class

CR> I have a class that won't be instantiated...so basically just a bunch
CR> of static methods.

CR> How do I call one of the class' static methods from within another
CR> method?  Can't use this, and self doesn't work...this is php4.

CR> Thanks.

CR> Class Foo{

CR>    function getMe(){
CR>     return "me";

CR>   }

CR>   function getUs(){
CR>    $us=xxx::getMe();
CR>    $us.="& me";

CR>   }
CR> }

CR> echo Foo::getUs();

Just use the class name Foo::getMe()

Class Foo{

   function getMe(){
    return "me";

  }

  function getUs(){
   $us=Foo::getMe();
   $us.="& me";

  }
}

-- 
regards,
Tom

-- 
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