3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $zip = new ZipArchive; $res = $zip->open(dirname(__FILE__) . '/bug64342.zip', ZipArchive::CREATE); if ($res === TRUE) { $f = 'aaaaaaaaaaaaaa.txt'; echo "$f\n"; $res = $zip->addFile($f); if (true == $res) { echo "add ok\n"; } else { echo "add failed\n"; } $res = $zip->close(); if (true == $res) { echo "close ok\n"; } else { echo "close failed\n"; } } else { echo "open failed\n"; }
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Class 'ZipArchive' not found in /in/hUQNP:2 Stack trace: #0 {main} thrown in /in/hUQNP on line 2
Process exited with code 255.
Output for 5.2.0 - 5.2.6, 5.3.25 - 5.3.29, hhvm-3.10.0 - 3.12.0
aaaaaaaaaaaaaa.txt add failed close ok
Output for 5.0.0 - 5.1.6, 5.4.0 - 5.6.28
Fatal error: Class 'ZipArchive' not found in /in/hUQNP on line 2
Process exited with code 255.
Output for 5.2.7 - 5.3.24
aaaaaaaaaaaaaa.txt add ok close failed
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/hUQNP on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/hUQNP on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/hUQNP on line 3
Process exited with code 255.