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 $object1; public $object2; } /* class MyCloneable { public function __invoke($object1,$object2) { $this->oject1=$object1; $this->oject2=$object2; } }*/ $obj = new MyCloneable(); $obj->object1 = new SubObject(); $obj->object2 = new SubObject(); $obj2= new $obj->object1 && new $obj->object2 print("Oggetto originale:\n"); print_r($obj); print("Oggetto originale:\n"); print_r($obj2); ?>
Output for 5.4.0 - 5.4.19, 5.5.0 - 5.5.3
Parse error: syntax error, unexpected 'print' (T_PRINT) in /in/Le70H on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_PRINT in /in/Le70H on line 37
Process exited with code 255.

preferences:
178.83 ms | 1395 KiB | 59 Q