How to extract ZIP file using PHP

If you migrate from other hosting to best hosting this will be useful

<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
    $zip->extractTo('/my/destination/dir/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>
2 Likes

This is more better i believe :wink:

1 Like