3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = tempnam(sys_get_temp_dir()); file_put_contents(<<<HEREDOC lots of lines HEREDOC); var_dump(nl2br(file_get_contents($file)));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught ArgumentCountError: tempnam() expects exactly 2 arguments, 1 given in /in/lX6Vb:3 Stack trace: #0 /in/lX6Vb(3): tempnam('/tmp') #1 {main} thrown in /in/lX6Vb on line 3
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.3 - 7.4.33
Warning: tempnam() expects exactly 2 parameters, 1 given in /in/lX6Vb on line 3 Warning: file_put_contents() expects at least 2 parameters, 1 given in /in/lX6Vb on line 5 Warning: file_get_contents(): Filename cannot be empty in /in/lX6Vb on line 10 string(0) ""
Output for 5.4.0 - 5.4.23, 7.2.29 - 7.2.33
Parse error: syntax error, unexpected end of file in /in/lX6Vb on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end in /in/lX6Vb on line 10
Process exited with code 255.

preferences:
148.19 ms | 401 KiB | 188 Q