PHP
  Home arrow PHP arrow Page 3 - Tracking a Stack of Function Calls with the Xdebug Extension
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Tracking a Stack of Function Calls with the Xdebug Extension
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-03-16


    Table of Contents:
  • Tracking a Stack of Function Calls with the Xdebug Extension
  • Review: the xdebug_time_index() function
  • Retrieving information with the xdebug_get_function_stack() function
  • Displaying the contents of the stack of function calls

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Tracking a Stack of Function Calls with the Xdebug Extension - Retrieving information with the xdebug_get_function_stack() function
    ( Page 3 of 4 )

    To show you the use of the “xdebug_get_function_stack()” function as clearly as possible, I’m going to build another sample class. It will be tasked with performing a pretty trivial task -- decorating any string passed in as an incoming argument with a few stars.

    Regardless of the simplicity of the logic implemented by this class, it should illustrate how to use the “xdebug_get_function_stack()” function in a specific case.

    Here’s the signature corresponding to this sample class, which I dubbed “NameDecorator”:


    class NameDecorator{

    public function displayStars(){

    var_dump(xdebug_get_function_stack());

    return str_repeat('*',10);

    }

    public function displayDecoratedName($names=array()){

    foreach($names as $name){

    echo $this->displayStars().' '.$name.'<br />';

    }

    }

    } 


    Definitely, the signature of the above “NameDecorator” class is pretty easy to follow, isn’t it? As shown before, this class declares and implements only two basic methods. The first one is charged with generating a string composed of ten star characters, which will be added to each name passed in as an input parameter.

    This “decorative” process will be performed by the second “displayDecoratedName()” method, which you should grasp in a snap. However, the most important thing to note here is that the class will make use of the “xdebug_get_function_stack()” function to display the content of the stack of function calls.

    Now that there’s a sample class available for illustrating how the “xdebug_get_function_stack()” function does its thing, it’s time to create a final example to show you how this function can keep track of the stack of methods called by the “NameDecorator” class.

    Wait are you waiting for? Click on the link  below and read the following section.



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek