downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.debug-backtrace.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.errorfunc.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.debug-backtrace.php',
   
1 => 'debug_backtrace',
  ),
 
'up' =>
  array (
   
0 => 'ref.errorfunc.php',
   
1 => 'Error Handling Functions',
  ),
 
'prev' =>
  array (
   
0 => 'ref.errorfunc.php',
   
1 => 'Error Handling Functions',
  ),
 
'next' =>
  array (
   
0 => 'function.debug-print-backtrace.php',
   
1 => 'debug_print_backtrace',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.debug-backtrace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">debug_backtrace</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">debug_backtrace</span> &mdash; <span class="dc-title">Generates a backtrace</span></p>

 </div>

 <a name="function.debug-backtrace.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><b>debug_backtrace</b></span>
    ([ <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$provide_object</tt><span class="initializer"> = true</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   <b>debug_backtrace()</b> generates a PHP backtrace.
  </p>
 </div>


 <a name="function.debug-backtrace.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">provide_object</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Whether or not to populate the &quot;object&quot; index. Defaults to <b><tt class="constant">TRUE</tt></b>.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.debug-backtrace.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative <a href="language.types.array.php" class="type array">array</a>. The possible returned elements
   are as follows:
  </p>
  <p class="para">
   </p><table class="doctable table">
    <caption><b>Possible returned elements from <b>debug_backtrace()</b></b></caption>
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Name</th>
       <th>Type</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left">function</td>
       <td align="left"><a href="language.types.string.php" class="type string">string</a></td>
       <td align="left">
        The current function name.  See also
        <a href="language.constants.predefined.php" class="link">__FUNCTION__</a>.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">line</td>
       <td align="left"><a href="language.types.integer.php" class="type integer">integer</a></td>
       <td align="left">
        The current line number.  See also
        <a href="language.constants.predefined.php" class="link">__LINE__</a>.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">file</td>
       <td align="left"><a href="language.types.string.php" class="type string">string</a></td>
       <td align="left">
        The current file name.  See also
        <a href="language.constants.predefined.php" class="link">__FILE__</a>.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">class</td>
       <td align="left"><a href="language.types.string.php" class="type string">string</a></td>
       <td align="left">
        The current <a href="language.oop5.php" class="link">class</a> name.  See also
        <a href="language.constants.predefined.php" class="link">__CLASS__</a>
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">object</td>
       <td align="left"><a href="language.types.object.php" class="type object">object</a></td>
       <td align="left">
        The current <a href="language.oop5.php" class="link">object</a>.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">type</td>
       <td align="left"><a href="language.types.string.php" class="type string">string</a></td>
       <td align="left">
        The current call type. If a method call, &quot;-&gt;&quot; is returned. If a static
        method call, &quot;::&quot; is returned. If a function call, nothing is returned.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">args</td>
       <td align="left"><a href="language.types.array.php" class="type array">array</a></td>
       <td align="left">
        If inside a function, this lists the functions arguments.  If
        inside an included file, this lists the included file name(s).
       </td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
 </div>


 <a name="function.debug-backtrace.changelog"></a><div class="refsect1 changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   </p><table class="doctable informaltable">
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left">5.2.5</td>
       <td align="left">
        Added the optional parameter <i><tt class="parameter">provide_object</tt></i>
.
       </td>
      </tr>

      <tr valign="middle">
       <td align="left">5.1.1</td>
       <td align="left">
        Added the current <a href="language.types.object.php" class="type object">object</a> as a possible return element.
       </td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
 </div>


 <a name="function.debug-backtrace.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>debug_backtrace()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;filename:&nbsp;/tmp/a.php<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">a_test</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"\nHi:&nbsp;</span><span style="color: #0000BB">$str</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">debug_backtrace</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #0000BB">a_test</span><span style="color: #007700">(</span><span style="color: #DD0000">'friend'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span><br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;filename:&nbsp;/tmp/b.php<br /></span><span style="color: #007700">include_once&nbsp;</span><span style="color: #DD0000">'/tmp/a.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>
     Results similar to the following when executing
    <var class="filename">/tmp/b.php</var>:
    </p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Hi: friend
array(2) {
[0]=&gt;
array(4) {
    [&quot;file&quot;] =&gt; string(10) &quot;/tmp/a.php&quot;
    [&quot;line&quot;] =&gt; int(10)
    [&quot;function&quot;] =&gt; string(6) &quot;a_test&quot;
    [&quot;args&quot;]=&gt;
    array(1) {
      [0] =&gt; &amp;string(6) &quot;friend&quot;
    }
}
[1]=&gt;
array(4) {
    [&quot;file&quot;] =&gt; string(10) &quot;/tmp/b.php&quot;
    [&quot;line&quot;] =&gt; int(2)
    [&quot;args&quot;] =&gt;
    array(1) {
      [0] =&gt; string(10) &quot;/tmp/a.php&quot;
    }
    [&quot;function&quot;] =&gt; string(12) &quot;include_once&quot;
  }
}
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.debug-backtrace.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.trigger-error.php" class="function" rel="rdfs-seeAlso">trigger_error()</a> - Generates a user-level error/warning/notice message</li>
    <li class="member"><a href="function.debug-print-backtrace.php" class="function" rel="rdfs-seeAlso">debug_print_backtrace()</a> - Prints a backtrace</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites