3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SubObject { static $instances = 0; public $instance; public function __construct() { $this->instance = ++self::$instances; } class MyCloneable { public function __invoke($object1,$object2) { $this->oject1=$object1; $this->oject2=$object2; } } $obj = new MyCloneable(); $obj->object1 = new SubObject(); $obj->object2 = new SubObject(); print("Oggetto originale:\n"); print_r($obj); ?>
Output for 5.4.0 - 5.4.19, 5.5.0 - 5.5.3
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in /in/O3Ee3 on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in /in/O3Ee3 on line 13
Process exited with code 255.

preferences:
179.06 ms | 1386 KiB | 59 Q