3v4l.org

run code in 500+ 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.7
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.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 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
Output for 5.4.0
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

preferences:
62.68 ms | 919 KiB | 4 Q