<?php

 // pretty-print var_export 
function var_format($v)
{ 
    return (str_replace(array("\n"," ","array"), 
array("<br>","&nbsp;","&nbsp;<i>array</i>"), 
var_export($v,true))."<br>"); 
} 

function errorKill($info)
{ 

    $out="<br>MSG='$info'"; 
    $bt=debug_backtrace(); 
    $sp=0; 
    $trace=""; 
    foreach($bt as $k=>$v) 
    { 
        extract($v); 
        $file=substr($file,1+strrpos($file,"/")); 

        $trace.=str_repeat("&nbsp;",++$sp); //spaces(++$sp); 
        $trace.="file=$file, line=$line, function=$function<br>";        
    } 
    $out.="<br>".$trace; 
    if(substr($info,0,4)=="XXX ") // special errrors when db is inaccessible 
    { 
        $out=str_replace("<br>","\n",$out); 
        $out=str_replace("&nbsp;"," ",$out); 
       
    } 
  return $out;
    
} 

?>