Instantly share code, notes, and snippets.

Embed
What would you like to do?
Функция для распечатки массива, с выводом дебаг информации
<?
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