NYCPHP Meetup

NYPHP.org

[nycphp-talk] require_once paranoia?

Daniel Convissor danielc at analysisandsolutions.com
Sat Nov 1 13:25:27 EDT 2008


Hey Michael:

On Sat, Nov 01, 2008 at 12:12:40PM -0400, Michael B Allen wrote:
> 
> Why is this so? If you do not call require_once until you actually
> need the class, I fail to see why __autoload would make any difference
> as you still need to read the file from disk and interpret it either
> way.

Depends on how efficiently you lay out your application's files.  You're 
right if you do a good job and/or the application is small.

But when you have a large application that has multiple files that 
require the same files, PHP will need to to determine the full path to 
each file over and over and over.

This is where autoload is helpful, because if your class/file has already 
been loaded, PHP doesn't need to check for it again.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list