3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php include('/tmp/test.txt'); $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 = '/etc/httpd/conf/'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2);
Output for 5.6.30, 7.0.0 - 7.1.14, 7.1.16 - 7.1.17, 7.1.19 - 7.2.1, 7.2.3 - 7.2.9
Warning: include(/tmp/test.txt): failed to open stream: No such file or directory in /in/sAk0F on line 2 Warning: include(): Failed opening '/tmp/test.txt' for inclusion (include_path='.:') in /in/sAk0F on line 2 / /tmp Warning: scandir(/etc/httpd/conf/): failed to open dir: No such file or directory in /in/sAk0F on line 19 Warning: scandir(): (errno 2): No such file or directory in /in/sAk0F on line 19 Warning: scandir(/etc/httpd/conf/): failed to open dir: No such file or directory in /in/sAk0F on line 20 Warning: scandir(): (errno 2): No such file or directory in /in/sAk0F on line 20
Output for 7.1.15, 7.1.18, 7.2.2
John Doe Jane Doe / /tmp Warning: scandir(/etc/httpd/conf/): failed to open dir: No such file or directory in /in/sAk0F on line 19 Warning: scandir(): (errno 2): No such file or directory in /in/sAk0F on line 19 Warning: scandir(/etc/httpd/conf/): failed to open dir: No such file or directory in /in/sAk0F on line 20 Warning: scandir(): (errno 2): No such file or directory in /in/sAk0F on line 20
Output for hhvm-3.22.0
Warning: include(/tmp/test.txt): File not found in /in/sAk0F on line -1 / /tmp Warning: No such file or directory in /in/sAk0F on line -1 Warning: No such file or directory in /in/sAk0F on line -1
Output for hhvm-3.15.4 - 3.21.3
Warning: include(/tmp/test.txt): File not found in /in/sAk0F on line 2 / /tmp Warning: No such file or directory in /in/sAk0F on line 19 Warning: No such file or directory in /in/sAk0F on line 20