Re: class functions where the function name == class name
| From: | Justin Patrin | Date: | Tue, 13 Jan 2004 16:49:26 +0000 |
| Subject: | Re: class functions where the function name == class name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174468@lists.php.net to get a copy of this message | ||
Glenn Yonemitsu wrote:
Hey there guys I just started trying out with writing classes. I've been looking at a lot of PEAR class files and noticed this: class classname { function classname() { } } I know that "$object = new classname;" will automatically run $object->classname();. But is it neccessary for every class to have this function? I read all these scripts and they all have them. I made one simple database class but it failed horribly, and I'm curious to if the initiated functions have anything to do with them. Thanks. GlennIf you're writing a database abstraction class, you may want to look at PEAR's DB and related packages. http://pear.php.net/package/DB -- paperCrane <Justin Patrin> -- Question Everything, Reject Nothing