3v4l.org

run code in 500+ 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.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
ab::__construct ab::__construct ab::__construct ab::__construct ab::__construct

preferences:
51.87 ms | 873 KiB | 4 Q