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; } $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
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in /in/WnrrK 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/WnrrK on line 13
Process exited with code 255.

preferences:
181.84 ms | 1386 KiB | 55 Q