3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //include('/etc/profile'); $myfile = fopen("/tmp/hacked.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); $txt = "Jane Doe\n"; fwrite($myfile, $txt); fclose($myfile); include('/tmp/hacked.txt'); 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.1, 7.0.3, 7.0.6 - 7.0.7, 7.0.9, 7.0.11 - 7.0.12, 7.0.14 - 7.0.15, 7.0.22 - 7.0.30, 7.1.9 - 7.1.16, 7.1.18, 7.1.21 - 7.2.4, 7.2.6, 7.2.9
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => hacked.txt ) Array ( [0] => hacked.txt [1] => .. [2] => . )
Output for 7.0.0, 7.0.2, 7.0.4 - 7.0.5, 7.0.8, 7.0.10, 7.0.13, 7.0.16 - 7.0.20, 7.0.31 - 7.1.3, 7.1.8, 7.1.17, 7.1.19 - 7.1.20, 7.2.5, 7.2.7 - 7.2.8
John Doe Jane Doe Array ( [0] => . [1] => .. ) Array ( [0] => .. [1] => . )
Output for 7.1.7
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => hacked.txt [3] => perf-26731.map ) Array ( [0] => perf-26731.map [1] => hacked.txt [2] => .. [3] => . )
Output for 7.1.6
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => perf-26738.map ) Array ( [0] => perf-26738.map [1] => .. [2] => . )
Output for 7.1.5
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => perf-26749.map ) Array ( [0] => perf-26749.map [1] => .. [2] => . )
Output for 7.1.4
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => perf-26764.map ) Array ( [0] => perf-26764.map [1] => .. [2] => . )
Output for 7.0.21
John Doe Jane Doe Array ( [0] => . [1] => .. [2] => perf-26735.map ) Array ( [0] => perf-26735.map [1] => .. [2] => . )
Output for hhvm-3.15.4 - 3.22.0
John Doe Jane Doe fork has been disabled for security reasons
Process exited with code 1.