1function d($data){
2 if(is_null($data)){
3 $str = "<i>NULL</i>";
4 }elseif($data == ""){
5 $str = "<i>Empty</i>";
6 }elseif(is_array($data)){
7 if(count($data) == 0){
8 $str = "<i>Empty array.</i>";
9 }else{
10 $str = "<table style=\"border-bottom:0px solid #000;\" cellpadding=\"0\" cellspacing=\"0\">";
11 foreach ($data as $key => $value) {
12 $str .= "<tr><td style=\"background-color:#008B8B; color:#FFF;border:1px solid #000;\">" . $key . "</td><td style=\"border:1px solid #000;\">" . d($value) . "</td></tr>";
13 }
14 $str .= "</table>";
15 }
16 }elseif(is_resource($data)){
17 while($arr = mysql_fetch_array($data)){
18 $data_array[] = $arr;
19 }
20 $str = d($data_array);
21 }elseif(is_object($data)){
22 $str = d(get_object_vars($data));
23 }elseif(is_bool($data)){
24 $str = "<i>" . ($data ? "True" : "False") . "</i>";
25 }else{
26 $str = $data;
27 $str = preg_replace("/\n/", "<br>\n", $str);
28 }
29 return $str;
30}
31
32function dnl($data){
33 echo d($data) . "<br>\n";
34}
35
36function dd($data){
37 echo dnl($data);
38 exit;
39}
40
41function ddt($message = ""){
42 echo "[" . date("Y/m/d H:i:s") . "]" . $message . "<br>\n";
43}
44