|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-30 12:28 UTC] sniper@php.net
[2005-09-30 12:29 UTC] sebastian@php.net
[2005-09-30 12:36 UTC] tony2001@php.net
[2005-09-30 12:42 UTC] sebastian@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 21:00:02 2025 UTC |
Description: ------------ test.php <?php include_once 'foo.php'; var_dump($GLOBALS['foo']); ?> foo.php <?php $foo = 'bar'; ?> Output string(3) "bar" test.php <?php class PHPUnit2_Util_Fileloader { public static function checkAndLoad($filename) { include_once $filename; } } PHPUnit2_Util_Fileloader::checkAndLoad('foo.php'); var_dump($GLOBALS['foo']); ?> foo.php <?php $foo = 'bar'; ?> Output NULL test.php <?php class PHPUnit2_Util_Fileloader { public static function checkAndLoad($filename) { include_once $filename; } } PHPUnit2_Util_Fileloader::checkAndLoad('foo.php'); var_dump($GLOBALS['foo']); ?> foo.php <?php $GLOBALS['foo'] = 'bar'; ?> Output string(3) "bar" Reproduce code: --------------- test.php <?php class PHPUnit2_Util_Fileloader { public static function checkAndLoad($filename) { include_once $filename; } } PHPUnit2_Util_Fileloader::checkAndLoad('foo.php'); var_dump($GLOBALS['foo']); ?> foo.php <?php $foo = 'bar'; ?> Expected result: ---------------- string(3) "bar" Actual result: -------------- NULL