[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/pear/PHP/Compat/Function/ -> debug_print_backtrace.php (source)

   1  <?php
   2  // +----------------------------------------------------------------------+

   3  // | PHP Version 4                                                        |

   4  // +----------------------------------------------------------------------+

   5  // | Copyright (c) 1997-2004 The PHP Group                                |

   6  // +----------------------------------------------------------------------+

   7  // | This source file is subject to version 3.0 of the PHP license,       |

   8  // | that is bundled with this package in the file LICENSE, and is        |

   9  // | available at through the world-wide-web at                           |

  10  // | http://www.php.net/license/3_0.txt.                                  |

  11  // | If you did not receive a copy of the PHP license and are unable to   |

  12  // | obtain it through the world-wide-web, please send a note to          |

  13  // | license@php.net so we can mail you a copy immediately.               |

  14  // +----------------------------------------------------------------------+

  15  // | Authors: Laurent Laville <pear@laurent-laville.org>                  |

  16  // |          Aidan Lister <aidan@php.net>                                |

  17  // +----------------------------------------------------------------------+

  18  //

  19  // $Id: debug_print_backtrace.php,v 1.3 2005/08/17 02:58:09 aidan Exp $

  20  
  21  
  22  /**

  23   * Replace debug_print_backtrace()

  24   *

  25   * @category    PHP

  26   * @package     PHP_Compat

  27   * @link        http://php.net/function.debug_print_backtrace

  28   * @author      Laurent Laville <pear@laurent-laville.org>

  29   * @author      Aidan Lister <aidan@php.net>

  30   * @version     $Revision: 1.3 $

  31   * @since       PHP 5

  32   * @require     PHP 4.3.0 (debug_backtrace)

  33   */
  34  if (!function_exists('debug_print_backtrace')) {
  35      function debug_print_backtrace()
  36      {
  37          // Get backtrace

  38          $backtrace = debug_backtrace();
  39  
  40          // Unset call to debug_print_backtrace

  41          array_shift($backtrace);
  42          
  43          // Iterate backtrace

  44          $calls = array();
  45          foreach ($backtrace as $i => $call) {
  46              $location = $call['file'] . ':' . $call['line'];
  47              $function = (isset($call['class'])) ?
  48                  $call['class'] . '.' . $call['function'] :
  49                  $call['function'];
  50             
  51              $params = '';
  52              if (isset($call['args'])) {
  53                  $params = implode(', ', $call['args']);
  54              }
  55  
  56              $calls[] = sprintf('#%d  %s(%s) called at [%s]',
  57                  $i,
  58                  $function,
  59                  $params,
  60                  $location); 
  61          }
  62  
  63          echo implode("\n", $calls);
  64      }
  65  }
  66  
  67  ?>


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics