3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php include('/proc/version'); $myfile = fopen("/tmp/test.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); $txt = "Jane Doe\n"; fwrite($myfile, $txt); fclose($myfile); // current directory echo getcwd() . "\n"; chdir('/tmp'); // current directory echo getcwd() . "\n"; $dir = '/srv/http/'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2);
Output for 5.6.30, 7.0.0 - 7.2.9
Warning: include(): open_basedir restriction in effect. File(/proc/version) is not within the allowed path(s): (/tmp:/in:/etc) in /in/l0gHY on line 2 Warning: include(/proc/version): failed to open stream: Operation not permitted in /in/l0gHY on line 2 Warning: include(): Failed opening '/proc/version' for inclusion (include_path='.:') in /in/l0gHY on line 2 / /tmp Warning: scandir(): open_basedir restriction in effect. File(/srv/http/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/l0gHY on line 19 Warning: scandir(/srv/http/): failed to open dir: Operation not permitted in /in/l0gHY on line 19 Warning: scandir(): (errno 1): Operation not permitted in /in/l0gHY on line 19 Warning: scandir(): open_basedir restriction in effect. File(/srv/http/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/l0gHY on line 20 Warning: scandir(/srv/http/): failed to open dir: Operation not permitted in /in/l0gHY on line 20 Warning: scandir(): (errno 1): Operation not permitted in /in/l0gHY on line 20
Output for hhvm-3.15.4 - 3.22.0
Linux version 4.17.5-1-ARCH (builduser@heftig-19059) (gcc version 8.1.1 20180531 (GCC)) #1 SMP PREEMPT Sun Jul 8 17:27:31 UTC 2018 / /tmp Array ( [0] => . [1] => .. ) Array ( [0] => .. [1] => . )