Re: PHP4 vs PHP5 classes
| From: | Jim Lucas | Date: | Tue, 29 Jul 2008 16:18:19 +0000 |
| Subject: | Re: PHP4 vs PHP5 classes | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277425@lists.php.net to get a copy of this message | ||
jeff.mills@winsto.net wrote:
Don't forget that in PHP5, the constructor named has changed. In PHP4 it called a method with the same name as the class. But, in PHP5, it looks for __construct() instead. I workaround that I use is this: <?php class myClass { function __construct() { } function myClass() {Maybe setting $this->max should be done in fetchSelectData since that's what is causing/creating your loop.Thanks Chris, I copied the code into the fetchSelectData function and it seems to be working fine now! Just need to test removing the code from the constructor to make sure its still working, and also test that php4 is still working. I'm just concerned that the code might also be called from somewhere else. You've cured my headache!
$this->__construct();} } ?> With this type of construct, your classes will initialize the same between PHP4 and PHP5. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare