note 44341 added to function.include-once

From: Date: Wed, 21 Jul 2004 15:53:16 +0000
Subject: note 44341 added to function.include-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-73812@lists.php.net to get a copy of this message
Besides being case-insensitive, PHP will not recognize the same include if the relative path is different ... for example: page1 sees that a user is not logged in and calls login page for the user to login. Once the user has completed the login form, the login page checks the database then includes page1 (where the user originally wanted to go). Both page1 and the login-processor need access to an include file which has db type functions in it. If the include path for one looks like: include_once("dbmodules.php"); and the other looks like: include_once("../functions/dbmodules.php"); the "dbmodules.php" file will be included twice and you'll get: Fatal error: Cannot redeclare ... (name of first function in file) ---- Manual Page -- http://www.php.net/manual/en/function.include-once.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44341 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44341&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44341&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#73812) next »