Bug #18262 Updated: Impossible to use INCLUDE inside CLASS definition
ID: 18262
Updated by: bmironov@jonview.com
Reported By: bmironov@jonview.com
Status: Open
Bug Type: *General Issues
Operating System: Linux RedHat 6.1
PHP Version: 4.1.2
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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
Thread (4 messages)