Bug #11047 Updated: Cannot put require() or include() within a class definition

From: Date: Wed, 23 May 2001 13:13:37 +0000
Subject: Bug #11047 Updated: Cannot put require() or include() within a class definition
Groups: php.dev 
Request: Send a blank email to php-dev+get-56483@lists.php.net to get a copy of this message
ID: 11047 User Update by: miguel222@mindless.com Old-Status: Closed Status: Open Bug Type: Feature/Change Request Operating system: RH Linux 7.0 PHP Version: 4.0.4pl1 Description: Cannot put require() or include() within a class definition This seems like an easy enough addition, and it makes building large libraries of homologous classes MUCH easier. Of course, there is a work-around: I can inherit numerous intermediate classes to simulate multiple inheritance, but that could theoretically become a VERY large overhead, if you have many "base" classes to inherit. Doing so also makes it difficult to read the resulting code. Previous Comments: --------------------------------------------------------------------------- [2001-05-23 14:39:40] cynic@php.net That's how it is, and how it'll be in foreseeable future. --------------------------------------------------------------------------- [2001-05-23 05:36:18] miguel222@mindless.com class foo { function foo() { } require "foo_functions.php"; } ~~~~ The above code returns the following parse error: Parse error: parse error, expecting T_OLD_FUNCTION' or T_FUNCTION' or T_VAR' or '}'' in foo.class.php on line 5 --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=11047

« previous php.dev (#56483) next »