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/apache'; $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(/tmp/test.txt): failed to open stream: No such file or directory in /in/Z7nXI on line 2 Warning: include(): Failed opening '/tmp/test.txt' for inclusion (include_path='.:') in /in/Z7nXI on line 2 / /tmp Warning: scandir(/etc/apache): failed to open dir: No such file or directory in /in/Z7nXI on line 19 Warning: scandir(): (errno 2): No such file or directory in /in/Z7nXI on line 19 Warning: scandir(/etc/apache): failed to open dir: No such file or directory in /in/Z7nXI on line 20 Warning: scandir(): (errno 2): No such file or directory in /in/Z7nXI on line 20
Output for hhvm-3.22.0
Warning: include(/tmp/test.txt): File not found in /in/Z7nXI on line -1 / /tmp Warning: No such file or directory in /in/Z7nXI on line -1 Warning: No such file or directory in /in/Z7nXI on line -1
Output for hhvm-3.15.4 - 3.21.3
Warning: include(/tmp/test.txt): File not found in /in/Z7nXI on line 2 / /tmp Warning: No such file or directory in /in/Z7nXI on line 19 Warning: No such file or directory in /in/Z7nXI on line 20