News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans' Blog:
Debugging Variables
February 10, 2011 @ 09:26:18

Derick Rethans has a new post to his blog today looking at a way you can dig inside of a variable that might be causing you trouble with the help of the debug_zval_dump method - a PHP function that dumps a string representation of an internal zend value directly to the standard output method (usually an "echo").

The internal representation of a PHP variable container (called zval), contains the type and value of a variable, but also whether it is a reference and what its refcount is. Due to PHP's copy-on-write policy, one specific zval container can be used by multiple variables at the same time as we will see in a bit.

He talks about what the "refcount" field of a variable means and some simple examples showing a single reference, more than one symbols and how PHP handles a "split upon assignment". He also mentions Xdebug's method xdebug_debug_zval that takes in a variable name rather than the variable itself.

1 comment voice your opinion now!
debug variable debugzvaldump tutorial


blog comments powered by Disqus

Similar Posts

The Geek Stuff: How to Configure Nginx to Execute PHP Using PHP-FPM

Zend Developer Zone: Flex and PHP: Party in the Front, Business in the Back

Zend Developer Zone: The Standard PHP Library (SPL)

Alfonso Jimenez's Blog: Integrating Yahoo r3 with Phing

DevShed: Effects of Wrapping Code in Class Constructs


Community Events





Don't see your event here?
Let us know!


introduction podcast symfony list zendserver framework laravel series community threedevsandamaybe api deployment release language developer tips conference code development interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework