note 17096 added to function.include-once

From: Date: Mon, 26 Nov 2001 13:32:06 +0000
Subject: note 17096 added to function.include-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-21280@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. -- http://www.php.net/manual/en/function.include-once.php http://master.php.net/manage/user-notes.php?action=edit+17096 http://master.php.net/manage/user-notes.php?action=delete+17096 http://master.php.net/manage/user-notes.php?action=reject+17096

« previous php.notes (#21280) next »