3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { private $name; private $age; function __construct($name, $age) { $this->name=$name; $this->age=$age; } function say() { echo "我的名字叫:".$this->name."<br />"; echo "我的年龄是:".$this->age; }}$p1 = new Person("张三", 20);p1->say();$p2 = clone $p1;$p2->say();?>
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/Y9dmq on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/Y9dmq on line 2
Process exited with code 255.

preferences:
192.44 ms | 1394 KiB | 63 Q