Class variable scope
Posted: Sat Aug 19, 2006 1:07 pm
Any reason why this wouldn't work?
I am getting undefined variable notices for all 3 of the echo's.
Code: Select all
class frustrated
{
const MY_CONSTANT = 3;
function __construct()
{
$test = "ya";
$foo = foo::getInstance();
}
function test_vars()
{
echo MY_CONSTANT;
echo $this->test;
echo $this->foo;
}
}