3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { function __construct() { var_dump(spl_object_id($this)); } } class b { function __construct() { var_dump(spl_object_id($this)); } } $a = new a; $b = new b; $c = new b;
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(1) int(2) int(3)
Output for 7.1.0 - 7.1.33
Fatal error: Uncaught Error: Call to undefined function spl_object_id() in /in/qAqB4:5 Stack trace: #0 /in/qAqB4(15): a->__construct() #1 {main} thrown in /in/qAqB4 on line 5
Process exited with code 255.

preferences:
191.91 ms | 401 KiB | 212 Q