why uninitialized property is made public in class?

后端 未结 3 1626
囚心锁ツ
囚心锁ツ 2021-01-26 03:28

Consider below code please:

class foo {
    function bar() {
        $this->baz = \'hello there!\';
    }
}

$f = new foo;
$f->bar();
echo $f->baz; // h         


        
3条回答
提交回复
热议问题