<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Prints a backtrace</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.debug-backtrace.html">debug_backtrace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.error-get-last.html">error_get_last</a></div> <div class="up"><a href="ref.errorfunc.html">Error Handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.debug-print-backtrace" class="refentry"> <div class="refnamediv"> <h1 class="refname">debug_print_backtrace</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">debug_print_backtrace</span> — <span class="dc-title"> Prints a backtrace </span></p> </div> <div class="refsect1 description" id="refsect1-function.debug-print-backtrace-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>debug_print_backtrace</strong></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$limit</code><span class="initializer"> = 0</span></span> ]] )</div> <p class="para rdfs-comment"> <span class="function"><strong>debug_print_backtrace()</strong></span> prints a PHP backtrace. It prints the function calls, included/required files and <span class="function"><a href="function.eval.html" class="function">eval()</a></span>ed stuff. </p> </div> <div class="refsect1 parameters" id="refsect1-function.debug-print-backtrace-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">options</code></em></span> <dd> <p class="para"> As of 5.3.6, this parameter is a bitmask for the following options: <table class="doctable table"> <caption><strong> <span class="function"><strong>debug_print_backtrace()</strong></span> options</strong></caption> <tbody class="tbody"> <tr> <td>DEBUG_BACKTRACE_IGNORE_ARGS</td> <td> Whether or not to omit the "args" index, and thus all the function/method arguments, to save memory. </td> </tr> </tbody> </table> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">limit</code></em></span> <dd> <p class="para"> As of 5.4.0, this parameter can be used to limit the number of stack frames printed. By default (<em><code class="parameter">limit</code></em>=<em>0</em>) it prints all stack frames. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.debug-print-backtrace-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 changelog" id="refsect1-function.debug-print-backtrace-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.4.0</td> <td> Added the optional parameter <em><code class="parameter">limit</code></em>. </td> </tr> <tr> <td>5.3.6</td> <td> Added the optional parameter <em><code class="parameter">options</code></em>. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.debug-print-backtrace-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-450"> <p><strong>Example #1 <span class="function"><strong>debug_print_backtrace()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// include.php file<br /><br /></span><span style="color: #007700">function </span><span style="color: #0000BB">a</span><span style="color: #007700">() {<br /> </span><span style="color: #0000BB">b</span><span style="color: #007700">();<br />}<br /><br />function </span><span style="color: #0000BB">b</span><span style="color: #007700">() {<br /> </span><span style="color: #0000BB">c</span><span style="color: #007700">();<br />}<br /><br />function </span><span style="color: #0000BB">c</span><span style="color: #007700">(){<br /> </span><span style="color: #0000BB">debug_print_backtrace</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">a</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// test.php file<br />// this is the file you should run<br /><br /></span><span style="color: #007700">include </span><span style="color: #DD0000">'include.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> #0 c() called at [/tmp/include.php:10] #1 b() called at [/tmp/include.php:6] #2 a() called at [/tmp/include.php:17] #3 include(/tmp/include.php) called at [/tmp/test.php:3] </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.debug-print-backtrace-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.debug-backtrace.html" class="function" rel="rdfs-seeAlso">debug_backtrace()</a> - Generates a backtrace</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.debug-backtrace.html">debug_backtrace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.error-get-last.html">error_get_last</a></div> <div class="up"><a href="ref.errorfunc.html">Error Handling Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>