Skip to content

Instantly share code, notes, and snippets.

@lleitep3
Created June 17, 2011 02:31
Show Gist options
  • Save lleitep3/1030747 to your computer and use it in GitHub Desktop.
Save lleitep3/1030747 to your computer and use it in GitHub Desktop.
get encoded by files of directory
<?php
function listEncodingPath($path)
{
$finfo = new finfo(FILEINFO_MIME_ENCODING, "/usr/share/misc/magic");
foreach(new DirectoryIterator($path) as $file)
if(!$file->isDot() && !$file->isDir())
$return[$file->getBasename()] = $finfo->file($file->getPathname());
return $return;
}
foreach(listEncodingPath('/var/www/project') as $key => $value)
echo '<br>' . $key . ' = ' . $value;
<?php
function listEncodingPath($path)
{
$finfo = new finfo(FILEINFO_MIME_ENCODING, "/usr/share/misc/magic");
foreach(new DirectoryIterator($path) as $file)
if(!$file->isDot() && !$file->isDir())
$return[$file->getBasename()] = $finfo->file($file->getPathname());
return $return;
}
foreach(listEncodingPath('/var/www/project') as $key => $value)
echo '<br>' . $key . ' = ' . $value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment