Name of Include File breaking a Function - Strange!
| From: | Monty | Date: | Fri, 09 Aug 2002 17:59:09 +0000 |
| Subject: | Name of Include File breaking a Function - Strange! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111870@lists.php.net to get a copy of this message | ||
I have an include file named functions.inc.php that I include in nearly
every script. For some bizarre reason, the following function inside this
file does not always work:
function user_acess() {
if ( isset($_SESSION['valid_user']) ) {
return 1;
}
return 0;
}
Most of the time it returns 0 (zero) even though I know the session variable
is set. However, if I rename the functions.inc.php file to functions.php and
make NO changes at all to the code, it suddenly works!? In fact, it seems
that if I rename the include file to anything but functions.inc.php, the
above function works as expected, returning 1 instead of 0. I tried
functions2.inc.php, funct.inc.php ... they all worked.
What the hell is going on here? How could the name of the include file
affect whether or not a function inside it will work?