[FX.php List] Which is faster?

Leo R. Lundgren leo at finalresort.org
Tue Sep 14 09:09:18 MDT 2010


That's not what I meant. Of course one reads the output of both these functions in a way so that whitespace is preserved.

I mean that the syntax/structure that var_dump outputs is not very readable, IMO, compared to print_r() or for example the Yii framework's CVarDumper.

I've pasted a comparison at http://paste.pocoo.org/show/likRmo55S81r4evSvFAn/ .


14 sep 2010 kl. 16.38 skrev Gjermund Gusland Thorsen:

> ehh, what about
> 
> echo '<pre>' . var_export( $b, true ) . '</pre>';
> 
> or add var_export( $b, true ) as content in field, or text file...
> 
> ggt
> 
> 2010/9/13 Leo R. Lundgren <leo at finalresort.org>:
>> 
>> 13 sep 2010 kl. 16.45 skrev Chris Hansen:
>> 
>>> 1) Try using var_dump() rather than print_r().  This is something that I first heard advocated by Lance Hallberg and it's a nice function.  It gives you not only the structure, but the number of elements and the type (so it's nice for troubleshooting === and !== as well...)  Also, var_dump() can be used for any expression so it's a good all-around tool.
>> 
>> The only downside to var_dump() (in my opinion) is that it is less readable for just a quick variable dump. So I prefer to use it as the default, and var_dump() when I need to look at the data in a more detailed manner (like you describe).
>> 
>> -|
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



-|



More information about the FX.php_List mailing list