|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-02-16 14:46 UTC] junkmail at lawrencebiblechapel dot org
in the documentation the following is noted:
require() is not actually a function in PHP; rather, it is a language construct. It is subject to some different rules than functions are. For instance, require() is not subject to any containing control structures.
I have found this statement ("not subject to any containing control structures") to NOT be true. I get an error for the following:
class myclass()
{
require("myfile.php")
};
I want to be able to include a function from another file that will become a method for the class.
Any suggestions?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
no bug, it is simply not possible this way, only "var" and "function" language constructs are allowed directly withing class {} the only way I see is passing your class and methods through eval()