ID: 21868 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Windoze PHP Version: 4.2.1 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You should use "global" declarations when you want to use global variables in the functions. Previous Comments: ------------------------------------------------------------------------ [2003-01-24 15:57:30] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21868&edit=1
