Re: Re-engineering print()

From: Date: Thu, 11 Jan 2001 06:35:01 +0000
Subject: Re: Re-engineering print()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-33909@lists.php.net to get a copy of this message
Look into output buffering (ob_* functions). You wouldn't want to do that with your whole script; but there is an example (if not in the manual it's on zend I believe) so you can assign the results (what would've been outputted to the browser without the buffering) to a variable. --Toby ----- Original Message ----- From: "Kristofer Widholm" <kristofer_widholm@bigfoot.com> To: <php-general@lists.php.net> Sent: Thursday, January 11, 2001 1:19 AM Subject: Re: [PHP] Re-engineering print() > Here's what you wrote, 01-01-11: > > > > $s = sprintf("%s", implode("\n", file('template.php'))); > > > >Why this??? It's redundant, isn't it? Wouldn't > > > >$s= implode("\n", file('template.php')); do it? > > > >Gfunk > > Gfunk, and Mr. Murray, > > I guess I didn't write my query very clearly. What I am looking for > is not just storing the PHP in a variable (that, as you both have > pointed out, is easy enough), but I want to EXECUTE the PHP script > (including it's print statements and everything) and instead of > having that output go directly to the browser, I want it to go to the > variable. The solutions offered certainly do put the PHP into a > variable, but it doesn't execute the PHP and have the output of the > executed PHP get stored into the variable. > > Thanks for familiarizing me with implode(), though, as I'm sure to > use that often. > > Sincerely, > Kristofer > -- > http://www.brokenhill.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~~~~~~~~~~~~~~~~~~~~~~~ > "The only real ideas are the ideas of the shipwrecked" > --Ortega y Gassett > > ~~~~~~~~~~~~~~~~~~~/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#33909) next »