note 17096 deleted from function.include-once by jimw

From: Date: Sat, 15 Dec 2001 22:13:34 +0000
Subject: note 17096 deleted from function.include-once by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22851@lists.php.net to get a copy of this message
On the other hand, you shouldn't use include_once where you might need to load a file more than once - for example, in the constructor of an class. If you use include_once, then you may not be able to create more than one instance of the class. I use include in a class which talks to an oracle database. I store the database password in an external file, so that it can be changed in a single location for all my apps which require it. This also adds security, since I keep the file outside the document root for the web server. It took me a while to realise that I wasn't able to instantiate the class more than once when I used include_once.

« previous php.notes (#22851) next »