|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-02-10 15:51 UTC] jimw@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
i have noticed a problem with the following php code is ran... <? class foo { function foo { require 'settings.php'; } } ?> settings.php ------------ <? var $foo_variable = 100; ?> the problem seems that when you include/require a file within a class constructor any variables that are initialized within the included file are not accessible o utside of the included php file (ie. i cannot use foo_variable later within the class foo.) I think this is caused because when the file settings.php is parsed it doesnt consider the variable eligible for the 'var' addition because of its lack of being within the function declaration (even though it really is.)