3v4l.org

run code in 300+ PHP versions simultaneously
<?php $handle = fopen("/dev/random\0.test", 'r'); echo fgets($handle);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ValueError: fopen(): Argument #1 ($filename) must not contain any null bytes in /in/Zj36o:3 Stack trace: #0 /in/Zj36o(3): fopen('/dev/random\x00.te...', 'r') #1 {main} thrown in /in/Zj36o on line 3
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.3 - 7.4.33
Warning: fopen() expects parameter 1 to be a valid path, string given in /in/Zj36o on line 3 Warning: fgets() expects parameter 1 to be resource, bool given in /in/Zj36o on line 5
Output for 5.4.0 - 5.4.23, 5.6.28, 7.0.14, 7.1.0, 7.2.29 - 7.2.33
Warning: fopen() expects parameter 1 to be a valid path, string given in /in/Zj36o on line 3 Warning: fgets() expects parameter 1 to be resource, boolean given in /in/Zj36o on line 5
Output for 5.3.5 - 5.3.28
Warning: fgets() expects parameter 1 to be resource, boolean given in /in/Zj36o on line 5

preferences:
141.8 ms | 401 KiB | 191 Q