3v4l.org

run code in 300+ PHP versions simultaneously
<?php file_put_contents('/path/to/file.txt', [1,2,3]); print file_get_contents('/path/to/file.txt'); // print 123
Output for 8.5.1 - 8.5.3
Warning: file_put_contents(/path/to/file.txt): Failed to open stream: No such file or directory in /in/sBflr on line 3 Warning: file_get_contents(/path/to/file.txt): Failed to open stream: No such file or directory in /in/sBflr on line 5
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0
Warning: file_put_contents(): open_basedir restriction in effect. File(/path/to/file.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/sBflr on line 3 Warning: file_put_contents(/path/to/file.txt): Failed to open stream: Operation not permitted in /in/sBflr on line 3 Warning: file_get_contents(): open_basedir restriction in effect. File(/path/to/file.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/sBflr on line 5 Warning: file_get_contents(/path/to/file.txt): Failed to open stream: Operation not permitted in /in/sBflr on line 5

preferences:
48.04 ms | 890 KiB | 4 Q