3v4l.org

run code in 300+ PHP versions simultaneously
<?php @error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS! @ini_set('display_errors', '1'); require_once('functions.php'); global $argv; #TODO: check for number of arguments passed $zip_info = pathinfo($argv[1]); if ($zip_info["extension"] !== "zip") { echo "Incorrect file provided. Please provide .zip file.\n"; exit(); } #TODO: check if user provided valid directory $copy_to_folders = get_folders($argv[2]); var_dump($argv); $zip_file = $argv[1]; echo $zip_file; $zip_parts = explode('.', $zip_file); $zip_name = $zip_parts[0]; $path_to_zip = pathinfo(realpath($zip_file), PATHINFO_DIRNAME); $zip = new ZipArchive; var_dump($zip); $result = $zip->open($zip_file); var_dump($result); if ($result === true) { $zip->extractTo($path_to_zip); $zip->close(); echo "success \n"; } function get_folders($path) { if(!is_dir($path)){ echo "ERROR: $path isn't a directory. Please provide valid directory for path.\n"; exit(); } $browsers = array(); if ($handle = opendir($path)) { chdir($path); $current_dir = getcwd(); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $browser = $current_dir . "/" . $entry; $browsers[] = $browser; } } closedir($handle); } return $browsers; }
Output for 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: require_once(): open_basedir restriction in effect. File(functions.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/2KIeU on line 5 Warning: require_once(functions.php): Failed to open stream: Operation not permitted in /in/2KIeU on line 5 Fatal error: Uncaught Error: Failed opening required 'functions.php' (include_path='.:') in /in/2KIeU:5 Stack trace: #0 {main} thrown in /in/2KIeU on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.13
Warning: require_once(functions.php): Failed to open stream: No such file or directory in /in/2KIeU on line 5 Fatal error: Uncaught Error: Failed opening required 'functions.php' (include_path='.:') in /in/2KIeU:5 Stack trace: #0 {main} thrown in /in/2KIeU on line 5
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25, 7.4.33
Warning: require_once(functions.php): failed to open stream: No such file or directory in /in/2KIeU on line 5 Fatal error: require_once(): Failed opening required 'functions.php' (include_path='.:') in /in/2KIeU on line 5
Process exited with code 255.
Output for 7.4.26 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(functions.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/2KIeU on line 5 Warning: require_once(functions.php): failed to open stream: Operation not permitted in /in/2KIeU on line 5 Fatal error: require_once(): Failed opening required 'functions.php' (include_path='.:') in /in/2KIeU on line 5
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Warning</b>: require_once(functions.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>/in/2KIeU</b> on line <b>5</b><br /> <br /> <b>Fatal error</b>: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'functions.php' (include_path='.:') in <b>/in/2KIeU</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.4.3 - 4.4.9, 5.0.0 - 5.0.5
<br /> <b>Warning</b>: main(functions.php) [<a href='function.main'>function.main</a>]: failed to open stream: No such file or directory in <b>/in/2KIeU</b> on line <b>5</b><br /> <br /> <b>Fatal error</b>: main() [<a href='function.require'>function.require</a>]: Failed opening required 'functions.php' (include_path='.:') in <b>/in/2KIeU</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.2
<br /> <b>Warning</b>: main(functions.php): failed to open stream: No such file or directory in <b>/in/2KIeU</b> on line <b>5</b><br /> <br /> <b>Fatal error</b>: main(): Failed opening required 'functions.php' (include_path='.:') in <b>/in/2KIeU</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: main(functions.php) [<a href='http://www.php.net/function.main'>function.main</a>]: failed to create stream: No such file or directory in <b>/in/2KIeU</b> on line <b>5</b><br /> <br /> <b>Fatal error</b>: main() [<a href='http://www.php.net/function.main'>function.main</a>]: Failed opening required 'functions.php' (include_path='.:') in <b>/in/2KIeU</b> on line <b>5</b><br />

preferences:
274.21 ms | 402 KiB | 464 Q