[PHP] classes and objects: php5. The Basics
Hi I'm stuck on The Basics page of the php5 Object Model: http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? regards dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] classes and objects: php5. The Basics
[snip] http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? [/snip] foo() is a function and would not be static, it can be public (default without explicit declaration in PHP5), protected and private. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes and objects: php5. The Basics
Backward compatibility with PHP4, where member functions couldn't be declared as static. Any member function could be called statically providing a static context instead of an object instance. 2007/1/16, Cheseldine, D. L. [EMAIL PROTECTED]: Hi I'm stuck on The Basics page of the php5 Object Model: http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? regards dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes and objects: php5. The Basics
Forgot to mention that calling a non-statical function this way should generate an E_STRICT warning. 2007/1/16, Martin Alterisio [EMAIL PROTECTED]: Backward compatibility with PHP4, where member functions couldn't be declared as static. Any member function could be called statically providing a static context instead of an object instance. 2007/1/16, Cheseldine, D. L. [EMAIL PROTECTED]: Hi I'm stuck on The Basics page of the php5 Object Model: http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? regards dave -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes and objects: php5. The Basics
Martin Alterisio wrote: Forgot to mention that calling a non-static function this way should generate an E_STRICT warning. and IIRC it will eventually be made a fatal error in php6, somebody please correct me if I'm wrong! 2007/1/16, Martin Alterisio [EMAIL PROTECTED]: Backward compatibility with PHP4, where member functions couldn't be declared as static. Any member function could be called statically providing a static context instead of an object instance. 2007/1/16, Cheseldine, D. L. [EMAIL PROTECTED]: Hi I'm stuck on The Basics page of the php5 Object Model: http://uk.php.net/manual/en/language.oop5.basic.php The top example has the code: A::foo(); even though foo is not declared static in its class. How does it get called statically without being declared static? regards dave -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php