3v4l.org

run code in 300+ PHP versions simultaneously
<?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) {}
based on gJFJp
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.31, 7.3.16 - 7.3.19, 7.4.0 - 7.4.7, 8.0.0alpha1 - alpha2
object(stdClass)#1 (0) { } object(class@anonymous)#2 (0) { } object(stdClass)#3 (0) { }