PHP
  Home arrow PHP arrow Using Conditional Statements 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? 
PHP

Using Conditional Statements with the Xdebug Extension
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-03-02


    Table of Contents:
  • Using Conditional Statements with the Xdebug Extension
  • Review: the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions
  • Extending the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions
  • Debugging conditionals with the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions

  • 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


    Using Conditional Statements with the Xdebug Extension
    ( Page 1 of 4 )

    In this fifth part of a series on using the Xdebug extension to help debug your PHP programs, we'll take a closer look at the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions. Specifically, we'll see how we can extend their usage when working with conditional statements. As always, we'll complement theory with a number of hands-on examples.

    Introduction

    Debugging a PHP application can be a challenging task, particularly when it’s necessary to evaluate the more complex facets of a program. By these I mean which functions are called by it, in what order, or even the performance of its different modules.

    In this situation, it's recommended that you use a third-party debugging library. You'll find a variety of these on the web these days. If you’re planning to pick up a package that lets you debug your PHP applications in a truly painless way, then you might want to take a closer look at the Xdebug extension. It's a friendly and powerful piece of software that will permit you to perform all sorts of debugging tasks, with minimal configuration requirements and an easy learning curve.

    And speaking of debugging tasks, you'll probably recall that I left off the last article discussing the use of the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions, which came in handy for keeping track of which lines are executed by a targeted PHP application.

    Speaking more specifically, in that tutorial I demonstrated how to utilize these functions to determine the execution flow of a simple script that created an instance of a sample class, and then called some of its methods. However, it’s much more interesting to use these functions to check the flow of a program when working with conditional statements.

    Undoubtedly, determining what code block is executed by an application, based on certain conditions, is a task that programmers have to face on a frequent basis, and the less effort this process involves, the better. Thus, provided that you’re interested in learning how to employ the xdebug_start_code_coverage() and xdebug_get_code_coverage() functions to debug conditional statements within a PHP program, in this fifth part of the series I’ll be coding for you some illustrative examples that will show you how to perform this debugging procedure in an approachable fashion.

    Now, let’s get rid of the preliminaries and start learning how to use the X-debug extension to work with conditionals in PHP. Let’s jump in!



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

       

    PHP ARTICLES

    - 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...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT