Skip to content

Instantly share code, notes, and snippets.

@navitronic
Created January 6, 2013 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navitronic/4470481 to your computer and use it in GitHub Desktop.
Save navitronic/4470481 to your computer and use it in GitHub Desktop.
<table><?php
$css_file = 'foo/bar.css';
$css = file_get_contents($css_file);
preg_match_all('/([a-zA-Z-]+)\:(.+)\;/', $css, $matches);
$totals = array();
foreach ($matches[0] as $match)
{
if (!isset($totals[$match])) $totals[$match] = 0;
$totals[$match]++;
}
arsort($totals);
foreach ($totals as $key => $count)
{
echo '<tr>';
echo '<td>' . $key .'</td>';
echo '<td>' . $count .'</td>';
echo '</tr>';
}
?>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment