/** * Get the trace of the current execution (debug_backtrace). * * @author David Callizaya * @param string $tts * @param string $limit * @return string */ function traceError($tts = 2, $limit = -1) { $trace = debug_backtrace(); $out = ''; foreach ($trace as $step) { if ($tts > 0) { $tts--; } else { $out .= '[' . basename($step['file']) . ': ' . $step['line'] . '] : ' . $step['function'] . '(' . DBConnection::printArgs($step['args']) . ")\n"; $limit--; if ($limit === 0) { return $out; } } } return $out; }