3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function doSomething(): array|null { } doSomething();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: doSomething(): Return value must be of type ?array, none returned in /in/R2380:7 Stack trace: #0 /in/R2380(9): doSomething() #1 {main} thrown in /in/R2380 on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected '|', expecting '{' in /in/R2380 on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Warning: Unsupported declare 'strict_types' in /in/R2380 on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/R2380 on line 5
Process exited with code 255.

preferences:
76.08 ms | 402 KiB | 45 Q