Skip to content

Instantly share code, notes, and snippets.

@iredun
Created August 22, 2015 21:28
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 iredun/f24320e7222206107ec4 to your computer and use it in GitHub Desktop.
Save iredun/f24320e7222206107ec4 to your computer and use it in GitHub Desktop.
Функция для распечатки массива, с выводом дебаг информации
<?
function pre($array=false,$description=false,$debug_print_trace=false) {
$debug_trace = debug_backtrace();
if($debug_print_trace){
foreach(debug_backtrace() as $k=>$v){
if($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require"){
$backtracel .= "#".$k." ".$v['function']."(".$v['args'][0].") called at [".$v['file'].":".$v['line']."]<br />";
}else{
$backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]<br />";
}
}
echo "<br /><b>".$backtracel."</b><br />";
}
else {
print( "<br /><b>".$debug_trace[0]["file"].": ".$debug_trace[0]["line"]."</b><br />");
}
if($description)
echo "<b>".$description."</b><br />";
echo "<pre>";
print_r($array);
echo "</pre>";
return true;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment