Link Details

Link 90410 thumbnail
User 274425 avatar

By jmathai
via jaisenmathai.com
Published: Jun 28 2008 / 10:04

PHP5 has an __autoload function which will handle automatically including class files when you use a class which has not yet been defined.
  • 9
  • 1
  • 1696
  • 365

Comments

Add your comment
User 297562 avatar

Sven Arild Helleland replied ago:

0 votes Vote down Vote up Reply

If you create the script with a proper layout/design from the start there is no reason to reply on __autoload() or include_once()/require_once().

User 308153 avatar

Zarquod replied ago:

0 votes Vote down Vote up Reply

Wasn't there recently an article somewhere which stated, in a nutshell, that __autoload() is horribly expensive, performancewise, and therefore should be avoided ...!?

User 274425 avatar

jmathai replied ago:

0 votes Vote down Vote up Reply

Cost is relative and building a scalable site doesn't hang on whether or not you use autoload. There are lots of tricks and tweaks you can use to change the behavior or file inclusions (amongst other things). For example, you can turn off apc.stat and you won't face the penalty of file system lookups when including a file.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (9)



Voters Against This Link (1)