📜  何时在 $this 上使用 self - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:49.535000             🧑  作者: Mango

代码示例1
class X {
    private $non_static_member = 1;
    private static $static_member = 2;

    function __construct() {
        echo $this->non_static_member . ' '
           . self::$static_member;
    }
}

new X();