/** * debuging (' DTrace '); //view Call Stack * debuging ($var); //print $var (var_dump) * debuging ($var, ' php '); //print $var (var_export) * debuging ($var, $echo, 2); //output $var * debuging (__line__.__class) in JSON format;//common use in large if statement body positioning, or looking for program end point */function debuging ($var = ', $echo = ', $die = false, $force = false) { static $clear; if (0 && $clear === null) { ob_end_flush (); $clear = true ; } static $d; if (0 && empty ( $d ) { $d = 1; debuging ( ' DTrace ' ); } $force && $_get [' Debug '] = 1; if (ISSET&NBSP; ( $_get [' Debug '] ) { if (' DTrace ' === $var) { dTrace ( $die ); } elseif ($die === 2) { header ( ' Content-type: application/json ' ); echo json_encode ( $var ); } else { echo "<pre>\n "; if ($echo) { echo "$echo:"; } if ($echo === ' php ') var_export ( $var ); else var_dump ( $var ); echo "</pre>\n"; } $die && die }}function dtrace ($die = false) { try { static $lastTime; $lastTime or $lastTime = $_server [' Request_time ']; throw new exception (); } catch ( Exception $e ) { $currTime = microtime ( true ); $totalTime = $currTime - $_ server [' request_time ']; $execTime = $currTime - $lastTime; $lastTime = $currTime; echo "\n PHP Debug Log program execution time and execution