<HTML ><HEAD ><TITLE >debug_backtrace</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="Error Handling and Logging Functions" HREF="ref.errorfunc.html"><LINK REL="PREVIOUS" TITLE="Error Handling and Logging Functions" HREF="ref.errorfunc.html"><LINK REL="NEXT" TITLE="error_log" HREF="function.error-log.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="ref.errorfunc.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.error-log.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.debug-backtrace" ></A >debug_backtrace</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN16846" ></A ><P > (PHP 4 >= 4.3.0)</P >debug_backtrace -- Generates a backtrace </DIV ><DIV CLASS="refsect1" ><A NAME="AEN16849" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >debug_backtrace</B > ( void)<BR ></BR ><P > <B CLASS="function" >debug_backtrace()</B > generates a PHP backtrace and returns this information as an associative <A HREF="language.types.array.html" ><B CLASS="type" >array</B ></A >. The possible returned elements are listed in the following table: </P ><P > <DIV CLASS="table" ><A NAME="AEN16859" ></A ><P ><B >Tabla 1. Possible returned elements from <B CLASS="function" >debug_backtrace()</B ></B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Name</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Type</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >function</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > The current function name. See also <A HREF="language.constants.predefined.html" >__FUNCTION__</A >. </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >line</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.html#language.types.integer" ><B CLASS="type" >integer</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > The current line number. See also <A HREF="language.constants.predefined.html" >__LINE__</A >. </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >file</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > The current file name. See also <A HREF="language.constants.predefined.html" >__FILE__</A >. </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >class</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > The current <A HREF="language.oop.html" >class</A > name. See also <A HREF="language.constants.predefined.html" >__CLASS__</A > </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >type</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > The current class type. </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >args</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><A HREF="language.types.array.html" ><B CLASS="type" >array</B ></A ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > If inside a function, this lists the functions arguments. If inside a included file, this lists the included file name(s). </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > The following is a simple example. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN16906" ></A ><P ><B >Ejemplo 1. <B CLASS="function" >debug_backtrace()</B > example </B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >// filename: a.php <?php function a_test($str) { print "\nHi: $str"; var_dump(debug_backtrace()); } a_test('friend'); ?> // filename: b.php <?php include_once '/tmp/a.php'; ?> /* Results when executing /tmp/b.php Hi: friend array(2) { [0]=> array(4) { ["file"] => string(10) "/tmp/a.php" ["line"] => int(10) ["function"] => string(6) "a_test" ["args"]=> array(1) { [0] => &string(6) "friend" } } [1]=> array(4) { ["file"] => string(10) "/tmp/b.php" ["line"] => int(2) ["args"] => array(1) { [0] => string(10) "/tmp/a.php" } ["function"] => string(12) "include_once" } } */</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.trigger-error.html" ><B CLASS="function" >trigger_error()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="ref.errorfunc.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.error-log.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Error Handling and Logging Functions</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.errorfunc.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >error_log</TD ></TR ></TABLE ></DIV ></BODY ></HTML >