open('test.zip', ZipArchive::CREATE); if ($res === TRUE) { $zip->addFromString('dir/test.txt', 'Type here the content-you want to add'); $zip->close(); echo 'Content added to Zip successfully'; } else { echo 'Failed to Add'; } ?>