Skip to content

Instantly share code, notes, and snippets.

@picasso250
Last active January 1, 2016 18:19
Show Gist options
  • Save picasso250/8182637 to your computer and use it in GitHub Desktop.
Save picasso250/8182637 to your computer and use it in GitHub Desktop.
<?php
static $traces;
if (!isset($traces)) {
$traces = array();
}
if (stripos($sql, "SELECT `t_acct_user`.* FROM `t_acct_user` WHERE `user_id` = '") !== false) {
var_dump($sql);
$trace = implode(' <== ', array_map(function($e){
$func = isset($e['class']) ? "$e[class]::$e[function]" : $e['function'];
return "$e[file]:$e[line] $func";
}, debug_backtrace()));
if (isset($traces[$trace])) {
$traces[$trace] ++;
} else {
$traces[$trace] = 1;
}
print_r($traces);
var_dump(max($traces));
}
<?php
$trace = implode("\n".' <== ', array_map(function($e){
$func = isset($e['class']) ? "$e[class]::$e[function]" : $e['function'];
return "$e[file]:$e[line] $func";
}, debug_backtrace()));
echo "$trace";
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment