ob_start();
echo "Hello";
$buffer = ob_get_clean();

Philip Arndt wrote:
> Hi,
> 
> I'm just wondering if anybody knows of a way to run a function that  
> contains print statements in a mode that will instead "print" to a  
> buffer that I can use inside another function?
> 
> e.g.
> 
> function do_something()
> {
>       print "{success: true}";
> }
> 
> but run this like so:
> 
> function do_something_else
> {
>       $result = print_to_variable(do_something);
> 
>       print $result . ", {returntype: string}";
> }
> 
> Probably a bit of a leftfield request, but that sort of thing is what  
> I'm after.
> 
> Cheers,
> Phil
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to