Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2. $file = file_get_contents("public/css/app.css");
  3.  
  4. preg_match_all("/\.[0-9A-Za-z\-_]+/", $file, $out);
  5.  
  6. usort($out[0], function ($a, $b) {
  7. return strlen($b) <=> strlen($a);
  8. });
  9. $arr = array_count_values($out[0]);
  10. print_r($arr);
  11.  
  12. foreach ($arr as $key => $value) {
  13. file_put_contents("out.csv", $key . ";" . $value . ";" . strlen($key) * $value ."\r\n", FILE_APPEND);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement