3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class DemoFile { public function run(array $data): void { try { foreach ($data as $key => $val) { throw new \Exception('test'); } } catch (\Throwable) { echo 'Failed at value '.$val; } } } $d = new DemoFile(); $d->run(['test']);
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Failed at value test

preferences:
50.8 ms | 406 KiB | 5 Q