Bug #18262 Updated: Impossible to use INCLUDE inside CLASS definition

From: Date: Wed, 10 Jul 2002 14:30:17 +0000
Subject: Bug #18262 Updated: Impossible to use INCLUDE inside CLASS definition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13737@lists.php.net to get a copy of this message
ID: 18262 Updated by: derick@php.net Reported By: bmironov@jonview.com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Linux RedHat 6.1 PHP Version: 4.1.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2002-07-10 10:30:08] bmironov@jonview.com Hello, We are using PHP in our projects. It would be nice to split some of our class definitions on several files. It seems a syntax problem for now (include / include_once / require / require_once are not allowed inside class definition). Could you please provide solution for the problem? Thanks, Boris ------------------------------------------------------------------------ [2002-07-10 10:26:40] bmironov@jonview.com File 1.php <?php class Test { var $text; function Test ($_text) { $this->text = $_text; } require_once ('2.inc'); } $a = new Test ("ABC"); $a->output(); ?> File 2.inc <?php function output () { print $this->text; } ?> It will produce following error: Parse error: parse error, unexpected T_REQUIRE_ONCE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /usr/local/apache/root/php/test/1.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18262&edit=1

« previous php.bugs (#13737) next »