3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php error_reporting(100); //include('/etc/profile'); $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); echo system("echo 'test' > /tmp/hacked.txt"); $dir = '/tmp/'; $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.21 - 7.2.5, 7.2.9
Array ( [0] => . [1] => .. [2] => test.txt ) Array ( [0] => test.txt [1] => .. [2] => . )
Output for 7.2.8
Array ( [0] => . [1] => .. [2] => perf-19238.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19238.map [2] => .. [3] => . )
Output for 7.2.7
Array ( [0] => . [1] => .. [2] => perf-19259.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19259.map [2] => .. [3] => . )
Output for 7.2.6
Array ( [0] => . [1] => .. [2] => perf-19275.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19275.map [2] => .. [3] => . )
Output for 7.1.20
Array ( [0] => . [1] => .. [2] => perf-19233.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19233.map [2] => .. [3] => . )
Output for 7.1.19
Array ( [0] => . [1] => .. [2] => perf-19256.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19256.map [2] => .. [3] => . )
Output for 7.1.18
Array ( [0] => . [1] => .. [2] => perf-19282.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19282.map [2] => .. [3] => . )
Output for 7.1.15
Array ( [0] => . [1] => .. [2] => perf-19315.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-19315.map [2] => .. [3] => . )
Output for hhvm-3.15.4 - 3.22.0
fork has been disabled for security reasons
Process exited with code 1.