Re: Static functions
| From: | Chris Hayes | Date: | Sun, 09 Feb 2003 21:49:01 +0000 |
| Subject: | Re: Static functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134976@lists.php.net to get a copy of this message | ||
At 22:18 9-2-2003, you wrote:
Hi, I'm a bit of a newbie to PHP, I've done some stuff in Java/VB/C++ but I'm having a few problems finding info on this issue. Does PHP support something like static functions in Java? afaik the answer is no, but please do not rely on my pitiful opinion. I only use my classes with one single object, just to keep the code cleaner.See one of the articles on objects, in no particular order:
PHP makers on OOP http://www.php.net/oop Lotsotalk http://www.liquidpulse.net/articles/125 knowledgebase http://www.faqts.com/knowledge_base/view.phtml/aid/7569 ZEND Using objects to create an application 1 http://www.zend.com/zend/tut/tutorial-johnson.phpZEND An Introduction to Classes http://www.zend.com/zend/tut/class-intro.php ZEND Overusing
OO http://www.zend.com/zend/art/mistake1.php#Heading13 Devarticles http://www.devarticles.com/art/1/241 http://www.devarticles.com/art/1/245 http://www.devarticles.com/art/1/262 http://www.devarticles.com/art/1/285 Devshed Accessing Databases with Class http://www.devshed.com/Server_Side/PHP/Class/ Back to Class http://www.devshed.com/Server_Side/PHP/BackToClass PHPBuilder Classes and PHP http://www.phpbuilder.com/columns/rod19990601.php3Vamsi: Object Oriented Programming in PHP http://php.vamsi.net/article/3/1 OOP Talk : A slide presentation http://www.sdphp.net/talks/talks/sdphp_class
for example in Java I can write:
public class someClass {
public static void someMethod() {}
PHP has no public or private methods
import someClass;
public class anotherClass {You can override a function with class y extends (class) x, see the articles for examplessomeClass.someMethod()} Is there some way to access methods of a class without creating an object in PHP? afaik you do need to create an object.
Right now I just include the file (not using a class) and then call the function but I would like to have it more seperate.