How to unzip zip file using PHP script ?

How to unzip zip file using PHP script ?

Here is the code for How to unzip zip file using PHP script . By this code you can easily zip or unzip your files and folders using PHP.
Some hosting provider don’t provide zip unzip facility on server control panel, so there is always problem for upload your project and download your code from it. we have a best solution for all developers and server admins that they can easilly make zip and unzip their files by using simple code for unzip zip file using PHP.
Dear Visitor , if you want to unzip , zip file , please find below script to unzip zip file.

Unzip zip file using PHP

Requirement:-
(PHP 5 >= 5.2.0, PHP 7, PECL zip >= 1.1.0)

ZipArchive::extractTo — Extract the archive contents and

Syntax:-
bool ZipArchive::extractTo ( string $destination [, mixed $entries ] )

Description:
Extract the complete archive or the given files to the specified destination.

<?php $unzip = new ZipArchive; $out = $unzip->open('your-zip-filename.zip');
if ($out === TRUE) {
  $unzip->extractTo(getcwd());
  $unzip->close();
  echo 'File unzipped Successfully';
} else {
  echo 'Something went wrong , Please Try Again ?';
}
?>

We hope this code will helps you to zip unzip file using php also make easy to upload and download your project.
also check How to disable right click, F12 & Ctrl+U .

how to get previous date using PHP ?

you can use strtotime function , to get all the solution , regarding date and time .
please find the below script to get previous date from current date

<?php 
echo date('Y-m-d', strtotime('-7 days')); // It shows 7 days previous date 
echo date('Y-m-d', strtotime('+4 days')); // It shows 4 days Next date 
?>

How to remove file extension from URL in PHP ?

How to remove file extension from URL in PHP ?

How to remove file extension from URL

It is very important to secure your site. you can hide or change or remove file extension from URL in  your PHP project. You must enable your mod_rewrite of Apache’s miraculous. a very simple and effective method of htaccess is RewriteRule, by RewriteRule yo can simply change or remove file extension from URL.
Use below code put it in your htaccess file your extension will be removed.  There are so many PHP methods that can secure your site, it is one of them .

you can use htaccess file , to remove file extension .

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

Please share your useful code and questions we will surely answer each question related PHP. Please comment your suggestion and changes for above code. please check How to find duplicate record from mysql database ?