note 28821 added to function.require

From: Date: Fri, 24 Jan 2003 21:53:08 +0000
Subject: note 28821 added to function.require
Groups: php.notes 
Request: Send a blank email to php-notes+get-42708@lists.php.net to get a copy of this message
A BIG ATTENTION! let`s say that we have this 2 files include.php & test.php: include.php <? $foo="blabla"; ?> and now test.php: <? require "include.php"; function do_test() { if ($foo) {echo "foo is set if called from function<br>";} else {echo "bang foo is not set if called from function<br>";} } do_test(); if ($foo) {echo "foo is set if called from main<br>";} else {echo "bang foo is not set if called from main<br>";} Result of the program is: bang foo is not set if called from function. foo is set if called from main Bug? Server: Apache/1.3.26 (Win32) PHP/4.2.3 -- http://www.php.net/manual/en/function.require.php http://master.php.net/manage/user-notes.php?action=edit+28821 http://master.php.net/manage/user-notes.php?action=delete+28821 http://master.php.net/manage/user-notes.php?action=reject+28821

« previous php.notes (#42708) next »