RE: [PHP] Simple (?) var_dump question [summarization]
| From: | Wouter van Vliet | Date: | Fri, 12 Sep 2003 17:29:46 +0000 |
| Subject: | RE: [PHP] Simple (?) var_dump question [summarization] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162443@lists.php.net to get a copy of this message | ||
WHOW .. that bool parameter never found it's way to me .. untill now ..
appears to be a new one in PHP4.3.
So, now let's summarize the var dumping and export functions:
print_r($mixed, [bool return])
- Produces quite readable output
var_export($mixed, [bool return])
- Produces valid php code
var_dump($mixed, $mixed1, ..)
- Produces quite unreadable and invalid php code
- tells you exactly what the type of your variable is
Think I got it quite right and complete, didn't I?
Wouter
-> -----Oorspronkelijk bericht-----
-> Van: CPT John W. Holmes [mailto:holmes072000@charter.net]
-> Verzonden: vrijdag 12 september 2003 19:06
-> Aan: Wouter van Vliet; Chris Boget; Thomas Panzarella;
-> php-general@lists.php.net
-> Onderwerp: Re: [PHP] Simple (?) var_dump question
->
->
-> From: "Wouter van Vliet" <wouter@esctoday.com>
->
->
-> > aiaiaia ... you are all pretty right, for another function was forged.
-> > var_export has a "return" flag as second argument where print_r and
-> var_dump
-> > both have other variables as second (and third, and fourth,
-> and sixth) ..
-> >
-> > So you can do: $logger->debug(var_export($Var), true)); which
-> will log the
-> > var to your log.
->
-> print_r() is also a BOOL for the second argument that controls whether a
-> value is returned or displayed.
->
-> The only difference between print_r() and var_export() produces
-> valid PHP
-> code.
->
-> The output from var_export() can only be captured with output buffering.
->
-> ---John Holmes...
->
-> --
-> PHP General Mailing List (http://www.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php