Re: About printing functions
| From: | Jan G.B. | Date: | Thu, 22 Jan 2009 11:29:28 +0000 |
| Subject: | Re: About printing functions | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286991@lists.php.net to get a copy of this message | ||
2009/1/21 Thodoris <tgol@kinetix.gr>:
>> <?php
>> ob_start();
>> badFunctionThatSpitsInsteadOfReturning();
>> $sReturned = ob_get_contents();
>> ob_end_clean();
>> ?>
>
> That's a good though thanks. Although I was aware of output buffering I used
> to ignore that ob_end_clean actually exists...
You can even make it shorter by using
ob_start(); echo 1;
$retVar = ob_get_clean();
http://de.php.net/ob_get_clean()
Byebye