Re: Piping print_r output to a variable

From: Date: Mon, 30 Jun 2003 19:57:00 +0000
Subject: Re: Piping print_r output to a variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153469@lists.php.net to get a copy of this message
On Tuesday 01 July 2003 03:35, Jay Blanchard wrote: > [snip] > > Is there a way I can pipe the output of print_r() into a variable for > further processing? > [/snip] > > $variable = print_r(); > > Then use $variable? With newer versions of php (check manual) you can specify an extra parameter like so: $output = print_r($some_var, 1) to have it return it's output. If you're using older versions of php then you need to do something like: ob_start(); print_r($some_var); $output = ob_get_contents(); ob_end_flush(); -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Do you mean that you not only want a wrong answer, but a certain wrong answer? -- Tobaben */

« previous php.general (#153469) next »