- Output for 7.1.0 - 7.1.16, 7.2.0 - 7.2.4
- Parse error: syntax error, unexpected '$obj2' (T_VARIABLE) in /in/gJFJp on line 5
Process exited with code 255.
<?php
$obj1 = new \stdClass; // Instantiate stdClass
object $obj2 = new class{}; // Instantiate anonymous class
$obj3 = (object)[]; // Cast empty array to object
var_dump($obj1); // object(stdClass)#1 (0) {}
var_dump($obj2); // object(class@anonymous)#2 (0) {}
var_dump($obj3); // object(stdClass)#3 (0) {}