title: Check if Zip file is encrypted or password protected using PHP
body: <p>I am writing a scanner that will look for possibly hacked/malware files. One requirement is to  check if a zip (or any compressed) file is password-protected using some PHP function.</p>
  
  <p>I don't want to add any extra software requirements, so should work on multiple servers, using PHP 5.3+ . (Yes I know that 5.3 is old, but the process may need to run on older PHP installations.) If this detection is available in newer PHP versions, then I could have code that would run only on newer PHP version.</p>
  
  <p>I can use the <code>file_get_contents()</code> function to read the file's contents into a string. How do I check that string for an indication that the zip file is password-protected? Note that I don't want to uncompress the file, just check it for password-protection.</p>
  
  <p>Thanks.</p>