PHP
  Home arrow PHP arrow Page 3 - Working with the X-debug extension`s var_dump() function
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

Working with the X-debug extension`s var_dump() function
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-02-17


    Table of Contents:
  • Working with the X-debug extension`s var_dump() function
  • Review: the xdebug_call_function() method
  • Using the enhanced version of the var_dump() PHP function
  • Retrieving information about a PHP object with the var_dump() function

  • 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


    Working with the X-debug extension`s var_dump() function - Using the enhanced version of the var_dump() PHP function
    ( Page 3 of 4 )

    As I mentioned in the section that you just read, the X-debug extension comes equipped with an enhanced version of the popular "var_dump()" native PHP function, which you may have used hundreds of times already when debugging your own PHP programs.

    The best way to grasp how this improved "var_dump()" function works is by means of a concrete example. With that idea in mind, below I set up for you a basic code sample that shows the real capabilities of this function. Have a look at it, please:


    $data=array('string'=>'This is a string','integer'=>1,'float'=>0.123456,'array'=>array(1,2,3,4,5,5));

    var_dump($data);


    /* displays the following

    array

    'string' => string 'This is a string' (length=16)

    'integer' => int 1

    'float' => float 0.123456

    'array' =>

    array

    0 => int 1

    1 => int 2

    2 => int 3

    3 => int 4

    4 => int 5

    5 => int 5

    */


    Despite the simplicity of the above example, it's pretty useful for demonstrating the completeness of the information returned by the "var_dump()" function when it's fed an array composed of different elements. In this particular case, the function not only is capable of retrieving the values assigned to each element of the $data array, but it returns the corresponding indexes, the length of the string elements (when applicable), and the type of data stored in each of them.

    As you can see, this enhanced version of the "var_dump()" PHP function permits you to obtain valuable information about a particular variable. This can be really useful for debugging several applications in depth. 

    So far, so good. By now you've grasped how the "var_dump()" function does its business, so it's time to finish this tutorial by coding a slightly more complex example. It will be aimed at illustrating how this function can be used for returning complete information about a specified PHP object.

    This topic will be covered in detail in the following section. Therefore, please read the next few lines.



     
     
    >>> 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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek