3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function void(): void { } function handleBatch(iterable $commands, callable $onEach = 'void'): void { foreach ($commands as $command) { // handle $command $onEach($command); } } handleBatch([new \stdClass()]);
Output for 8.3.0
Fatal error: Cannot use string as default value for parameter $onEach of type callable in /in/I5KWE on line 9
Process exited with code 255.
Output for 7.2.0 - 7.2.29, 7.3.0 - 7.3.17, 7.4.0 - 7.4.5
Fatal error: Default value for parameters with callable type can only be NULL in /in/I5KWE on line 9
Process exited with code 255.

preferences:
165.45 ms | 997 KiB | 7 Q