3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = sys_get_temp_dir() . '/test.tmp'; file_put_contents("abcd", $path); var_dump(mime_content_type($path) === 'text/plain'); file_put_contents("abc", $path); var_dump(mime_content_type($path) === 'text/plain');
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.17, 8.1.20 - 8.1.28, 8.2.0 - 8.2.4, 8.2.7 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: file_put_contents(): open_basedir restriction in effect. File(abcd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 4 Warning: file_put_contents(abcd): Failed to open stream: Operation not permitted in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(): open_basedir restriction in effect. File(abc) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 7 Warning: file_put_contents(abc): Failed to open stream: Operation not permitted in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: file_put_contents(): open_basedir restriction in effect. File(abcd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 4 Warning: file_put_contents(abcd): Failed to open stream: Operation not permitted in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(): open_basedir restriction in effect. File(abc) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 7 Warning: file_put_contents(abc): Failed to open stream: Operation not permitted in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 8.1.18 - 8.1.19, 8.2.5 - 8.2.6
Warning: file_put_contents(): open_basedir restriction in effect. File(abcd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 4 Warning: file_put_contents(abcd): Failed to open stream: Operation not permitted in /in/cRDDC on line 4 bool(true) Warning: file_put_contents(): open_basedir restriction in effect. File(abc) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 7 Warning: file_put_contents(abc): Failed to open stream: Operation not permitted in /in/cRDDC on line 7 bool(true)
Output for 8.0.13
Warning: file_put_contents(abcd): Failed to open stream: Read-only file system in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(abc): Failed to open stream: Read-only file system in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): Failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: file_put_contents(abcd): failed to open stream: Read-only file system in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(abc): failed to open stream: Read-only file system in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Warning: file_put_contents(): open_basedir restriction in effect. File(abcd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 4 Warning: file_put_contents(abcd): failed to open stream: Operation not permitted in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(): open_basedir restriction in effect. File(abc) is not within the allowed path(s): (/tmp:/in:/etc) in /in/cRDDC on line 7 Warning: file_put_contents(abc): failed to open stream: Operation not permitted in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 7.1.20, 7.2.6
Warning: file_put_contents(): open_basedir restriction in effect. File(abcd) is not within the allowed path(s): (/tmp:/in) in /in/cRDDC on line 4 Warning: file_put_contents(abcd): failed to open stream: Operation not permitted in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(): open_basedir restriction in effect. File(abc) is not within the allowed path(s): (/tmp:/in) in /in/cRDDC on line 7 Warning: file_put_contents(abc): failed to open stream: Operation not permitted in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 5.3.6 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24, 5.5.29, 5.5.32, 5.5.35, 5.6.10, 5.6.13, 5.6.18 - 5.6.28, 7.0.0 - 7.0.2, 7.0.4 - 7.0.5, 7.0.14 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0
Warning: file_put_contents(abcd): failed to open stream: Permission denied in /in/cRDDC on line 4 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(abc): failed to open stream: Permission denied in /in/cRDDC on line 7 Warning: mime_content_type(/tmp/test.tmp): failed to open stream: No such file or directory in /in/cRDDC on line 8 bool(false)
Output for 5.5.25 - 5.5.28, 5.5.30 - 5.5.31, 5.5.33 - 5.5.34, 5.6.8 - 5.6.9, 5.6.11 - 5.6.12, 5.6.14 - 5.6.17, 7.0.3, 7.0.6
Warning: file_put_contents(abcd): failed to open stream: Permission denied in /in/cRDDC on line 4 bool(true) Warning: file_put_contents(abc): failed to open stream: Permission denied in /in/cRDDC on line 7 bool(true)
Output for 5.3.0 - 5.3.5
Warning: file_put_contents(abcd): failed to open stream: Permission denied in /in/cRDDC on line 4 Warning: mime_content_type(): File or path not found '/tmp/test.tmp' in /in/cRDDC on line 5 bool(false) Warning: file_put_contents(abc): failed to open stream: Permission denied in /in/cRDDC on line 7 Warning: mime_content_type(): File or path not found '/tmp/test.tmp' in /in/cRDDC on line 8 bool(false)
Output for 5.2.1 - 5.2.17
Warning: file_put_contents(abcd): failed to open stream: Permission denied in /in/cRDDC on line 4 Fatal error: Call to undefined function mime_content_type() in /in/cRDDC on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function sys_get_temp_dir() in /in/cRDDC on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/cRDDC on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/cRDDC on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/cRDDC on line 3

preferences:
209.14 ms | 401 KiB | 312 Q