3v4l.org

run code in 300+ PHP versions simultaneously
<?php class zyf{ public $a=6; public $b; function zyf(){ echo $this->a; //可以输出 6 如果替换为echo $a ,将不显示任何结果,因为没有具体对象 } function add(){ $this->a=$c echo $c; } $xin = new zyf(); $xin->add(); ?>
Output for 5.4.0 - 5.4.11
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /in/elfHM on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.21
Parse error: syntax error, unexpected T_ECHO in /in/elfHM on line 10
Process exited with code 255.

preferences:
170.36 ms | 1395 KiB | 41 Q