I'm writing the following code, which doesn't print anything:
- Code: Select all
class MyClass {
private $id;
public $string = "iiii";
public function display () {
echo $string;
}
}
$b = new MyClass();
$b->display();
When I replace echo $string with echo "ok", it prints "ok".
Where is the error?



