Re: Rethink CS for require_once?
| From: | Lukas Smith | Date: | Wed, 01 Dec 2004 14:42:03 +0000 |
| Subject: | Re: Rethink CS for require_once? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34696@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Andrew Nagy wrote:Obviously the loadClass() method could call class_exists() before doing the require_once. regards, LukasGreg Beaver wrote:I don't know if this has been discussed before, but what about using just require for internal packages and require_once for external? Rasmus Lerdorf mentioned at a PHP conference that require_once is really slow and should be avoided at all costs. Considering the app programmer most likely will not be including files buried deep with in a pear package, this may be more beneficial? Has this been discussed?well its not going to work except if we start putting if (class_exists()) all over the place before an include. The future looks bright though with php5's autoload. Maybe we can think of a forward compatible way of handling autoload via a PEAR::loadClass() method. This method would essentially either load the class from a given name by replacing "_" with "/" and calling require_once() for PHP4 and do nothing for PHP5 relying on autoload to work (and our common autoload method would do essentially what the PHP4 version of the loadClass would do).