3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php $zipFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'filename.zip'; $password = 'P455W0RD'; if (file_exists($zipFilePath)) { unlink($zipFilePath); } $zipArchive = new ZipArchive(); $zipArchive->open($zipFilePath, ZipArchive::CREATE); if ($zipArchive->setPassword($password)) { echo 'OK' . PHP_EOL; } foreach (range(1, 10) as $fileNumber) { $zipArchive->addFromString('file' . $fileNumber . '.txt', rand()); } $zipArchive->close();
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.29
Parse error: syntax error, unexpected '<' in /in/M3u8D on line 2
Process exited with code 255.

preferences:
181.87 ms | 1395 KiB | 66 Q