Re: Emulation: $var = print_r($array)
| From: | Jason Wong | Date: | Thu, 04 Apr 2002 14:48:35 +0000 |
| Subject: | Re: Emulation: $var = print_r($array) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91518@lists.php.net to get a copy of this message | ||
On Thursday 04 April 2002 22:43, Julio Nobrega Trabalhando wrote:
> Is there a way to do something like this?
>
> I wrote a wanna-be debugger. It just write to a file simple and common
> used function and variables, array or objects. Then when I activate it, a
> new window is opened with these information. Simple stuff.
>
> The problem is that if I do this:
>
> fwrite($fp, $_SESSION);
>
> It will record Array, of course. If I serialize it, it's unreadble
> compared to print_r();
>
> $var = print_r($array), well, prints the array like I suspected.
>
> Is there a way to "emulate" var_dump(), print_r() so I can write it to a
> file and when I open this file the information are shown like if I really
> did a print_r();?
ob_start();
print_r($doo);
$dah = ob_get_contents();
ob_end_clean();
echo $dah;
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Whatever you do will be insignificant, but it is very important that you do
it.
-- Gandhi
*/