#9304 [Bgs]: require function generates error

From: Date: Tue, 19 Oct 2004 13:34:27 +0000
Subject: #9304 [Bgs]: require function generates error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67768@lists.php.net to get a copy of this message
ID: 9304 User updated by: junkmail at lawrencebiblechapel dot org -Reported By: flash at drewnels dot net +Reported By: junkmail at lawrencebiblechapel dot org Status: Bogus Bug Type: Scripting Engine problem Operating System: WinME PHP Version: 4.0.4 New Comment: thanks Previous Comments: ------------------------------------------------------------------------ [2001-02-16 22:57:45] andre@php.net 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() ------------------------------------------------------------------------ [2001-02-16 15:10:50] flash at drewnels dot net this error happens on all these commands: include() include_once() require() require_once() ------------------------------------------------------------------------ [2001-02-16 14:55:07] flash at drewnels dot net this error happens on all these commands: include() include_once() require() require_once() ------------------------------------------------------------------------ [2001-02-16 14:46:38] 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? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=9304&edit=1

« previous php.bugs (#67768) next »