Richard Lynch wrote:
But I don't think you can even *DO* an include() inside a class
definition, so that should be giving you an error...
You can do an include/require anywhere. However, you cannot declare new
functions inside an include and use it to add methods or variables to a
class.
-->--inc.php-->--
<?php
function foo()
{
return 'I pity to foo';
}
--<-----------<--
-->--use.php-->--
<?php
class bar
{
include('inc.php');
}
$b = new bar();
print $b->foo(); // This will not work
print foo(); // But this will
--<-----------<--
This will not work! foo() is actually defined at the global scope.
-Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php