From:             [EMAIL PROTECTED]
Operating system: Window 98
PHP version:      4.0.4pl1
PHP Bug Type:     *General Issues
Bug description:  require() does not work inside class bodies (ie. to pull in methods)

In file class.php:
--------------------------------------------------------
<?php

class myclass
{
  require( $DOCUMENT_ROOT . "/methods.inc.php" );
}

$myinstance = new myclass;
$myinstance->method();
?>
--------------------------------------------------------

In file methods.inc.php:
--------------------------------------------------------
<?php
function method()
{
  print "hi";
}
?>
--------------------------------------------------------

Accessing class.php returns the following error:
Parse error:  parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or 
`'}'' in class.php on line 5

Surely this should work?



-- 
Edit Bug report at: http://bugs.php.net/?id=10430&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to