3v4l.org

run code in 300+ PHP versions simultaneously
<?php // pre-requisite $a = 'a'; const ab = 'ab'; class ab { function __construct() { echo __METHOD__.PHP_EOL; } } // create classes new ab; new ab(); new (ab); new ($a.'b'); new (ab::class); // PHP 9, a wish! //new ()ab; ?>
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
ab::__construct ab::__construct ab::__construct ab::__construct ab::__construct

preferences:
50.43 ms | 851 KiB | 4 Q