Consider below code please:
class foo {
function bar() {
$this->baz = \'hello there!\';
}
}
$f = new foo;
$f->bar();
echo $f->baz; // h
Who told that you are not initialized,You have initialized by the statement $this->baz = 'hello there!';
This is how object oriented concept works.You are declaring a class , creating an instance for that class and then accessing that function and at last echoing a variable in that member function,This is how object orientation works...