3v4l.org

run code in 300+ PHP versions simultaneously
<?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 exec("echo "test" > /tmp/hacked.txt"); $dir = '/tmp/'; $files1 = scandir($dir); $files2 = scandir($dir, 1); print_r($files1); print_r($files2);
Output for 8.0.0 - 8.0.29, 8.1.0 - 8.1.20, 8.2.0 - 8.2.7
Parse error: syntax error, unexpected identifier "test", expecting ")" in /in/os1ns on line 10
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Parse error: syntax error, unexpected 'test' (T_STRING), expecting ')' in /in/os1ns on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34
Parse error: syntax error, unexpected 'test' (T_STRING), expecting ',' or ')' in /in/os1ns on line 10
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Parse error: syntax error, unexpected 'test' (T_STRING) in /in/os1ns on line 10
Process exited with code 255.

preferences:
295.53 ms | 1395 KiB | 275 Q