![]() |
debug_zval_dump vs. var_dump
What is the difference between the two? They both show the same outputs pretty much. What is refcount, as in? Err, like the number of references to that variable?
Like so: PHP Code:
That will output a total number of 2 references? cause $var2 and $var3 are referencing $var1's variable. So is that it? About var_dump and debug_zval_dump, one has refcount and the other doesn't? hmm.. |
After looking at the relevant PHP source code (in
ext/standard/var.c for those interested) it appears as though your assumption is correct. debug_zval_dump simply displays the associated refcount whereas var_dump does not.As for your code snippet, debug_zval_dump would report a refcount of 4, believe it or not. Once (1) for the first assignment of "Hello" to $var1. Another (2) for the assign-by-reference to $var2. Another (3) for the assign-by-reference to $var3. Finally another (4) reference is made when calling debug_zval_dump. |
Quote:
I guess that's because of me referencing in the arguments of the function? |
| All times are GMT. The time now is 03:22 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0