Skip to content

Instantly share code, notes, and snippets.

@gauthierm
Created December 13, 2017 21:13
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 gauthierm/86363b4c3b8433429ea328e1bb4e0702 to your computer and use it in GitHub Desktop.
Save gauthierm/86363b4c3b8433429ea328e1bb4e0702 to your computer and use it in GitHub Desktop.
<?php
$functions = [
'mail',
'strlen',
'strpos',
'strrpos',
'substr',
'strtolower',
'strtoupper',
'stripos',
'strripos',
'strstr',
'stristr',
'strrchr',
'substr_count',
];
foreach ($functions as $function) {
$expression = '[^A-Za-z0-9_]' . $function . '\(';
$matches = `ack -cl '$expression'`;
$lines = explode("\n", $matches);
$total = 0;
foreach ($lines as $line) {
$parts = explode(':', $line);
$count = intval(end($parts));
$total += $count;
}
echo str_pad($function, 12) . ' : ' . $total . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment