3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get folder name $folder = $params['folder']; $zipFolder = $folder . '.zip'; // Get instance of ZipArchive $zipArchive = new ZipArchive(); // Open zip archive $zipArchive->open($zipFolder, ZIPARCHIVE::CREATE); $zipArchive->addEmptyDir($folder); //zipFolderFiles($folder, $zipArchive); // Close zip archive $zipArchive->close(); // Download archive header('Content-Type: application/zip'); header('Content-disposition: attachment; filename=' . $zipFolder); header('Content-Length: ' . filesize($zipFolder)); readfile($zipFolder); // Recursive zip creation function function zipFolderFiles($dir, &$zipArchive) { //$base_path = './uploads/tenders/'; //$ffs = scandir($base_path . $dir); //if (!is_array($ffs) || empty($ffs)) return; //foreach ($ffs as $ff) { // if ($ff != '.' && $ff != '..') { // if (is_dir($base_path . $dir . '/' . $ff)) { // $zipArchive->addEmptyDir($ff); // zipFolderFiles($dir . '/' . $ff, $zipArchive); // } else { // $zipArchive->addFile($base_path . $dir . '/' . $ff, $ff); // } // } //} }
Output for git.master, git.master_jit
Warning: Undefined variable $params in /in/quReB on line 4 Warning: Trying to access array offset on value of type null in /in/quReB on line 4 Fatal error: Uncaught Error: Class "ZipArchive" not found in /in/quReB:8 Stack trace: #0 {main} thrown in /in/quReB on line 8
Process exited with code 255.
Output for rfc.property-hooks
Warning: Undefined variable $params in /in/quReB on line 4 Warning: Trying to access array offset on null in /in/quReB on line 4 Fatal error: Uncaught Error: Class "ZipArchive" not found in /in/quReB:8 Stack trace: #0 {main} thrown in /in/quReB on line 8
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
64.55 ms | 401 KiB | 8 Q