3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //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.2 - 7.0.14, 7.0.16 - 7.1.0, 7.1.2 - 7.2.9
Array ( [0] => . [1] => .. [2] => test.txt ) Array ( [0] => test.txt [1] => .. [2] => . )
Output for 7.1.1
Array ( [0] => . [1] => .. [2] => perf-2852.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-2852.map [2] => .. [3] => . )
Output for 7.0.15
Array ( [0] => . [1] => .. [2] => perf-2855.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-2855.map [2] => .. [3] => . )
Output for 7.0.1
Array ( [0] => . [1] => .. [2] => perf-2893.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-2893.map [2] => .. [3] => . )
Output for 7.0.0
Array ( [0] => . [1] => .. [2] => perf-2896.map [3] => test.txt ) Array ( [0] => test.txt [1] => perf-2896.map [2] => .. [3] => . )
Output for hhvm-3.15.4 - 3.22.0
fork has been disabled for security reasons
Process exited with code 1.