TABLE{border-collapse: collapse;} TH {text-align: right; background-color: lightgrey;} TH, TD{ border: 1px solid #000; padding: 3px;}
Debug
| File: |
%s |
| Line: |
%s |
| Message: |
%s |
';
$bt = debug_backtrace();
$caller = $bt[2]; //bt[0] - is \use \Traits\\Debug
$isVariableRecursive = self::isRecursive($value);
$data = $isVariableRecursive ? var_dump($value) : var_export($value, true);
$html = sprintf($html, $caller['file'], $caller['line'], $data);
echo $html;
if ($shouldExit) {
exit;
}
}
//https://stackoverflow.com/questions/17181375/test-if-variable-contains-circular-references
private static function isRecursive($array): bool {
$dump = print_r($array, true);
return strpos($dump, '*RECURSION*') !== false;
}
}