Skip to content

Instantly share code, notes, and snippets.

@horaciod
Last active June 20, 2021 22:18
Show Gist options
  • Select an option

  • Save horaciod/ef7c1f28fa1d3a4fc59c5b582f5a87fa to your computer and use it in GitHub Desktop.

Select an option

Save horaciod/ef7c1f28fa1d3a4fc59c5b582f5a87fa to your computer and use it in GitHub Desktop.
<?php
// obtener el listado de funciones que llama un objeto llamado conn
// grep -or "conn->.*.(" >/tmp/llamadas.txt
$f = file_get_contents('/tmp/llamadas.txt');
$lineas = explode("\n" , $f) ;
$aux = [ ];
foreach($lineas as $l){
if (strstr($l, 'vendor')===false)
$aux[] = firstStringBetween($l,'->', '(').PHP_EOL ;
}
sort($aux) ;
foreach(array_count_values($aux ) as $K=>$V){
echo trim($K) .'|'. trim($V).PHP_EOL ;
}
function firstStringBetween($haystack, $start, $end)
{
return trim(strstr(strstr($haystack, $start), $end, true), $start . $end);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment