ID: 10430
Updated by: andi
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: *General Issues
PHP Version: 4.0.4pl1
Assigned To:
Comments:
Right. require() and include() both happen at run-time while the class is checked for
method's at compile-time. You have to include the method definitions inside the class
{}
Andi
Previous Comments:
---------------------------------------------------------------------------
[2001-04-21 05:15:35] [EMAIL PROTECTED]
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?
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10430&edit=2
--
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]