Posted by gosha bine on 06/22/07 09:53
On 22.06.2007 03:46 onlineviewer wrote:
> Hello All,
>
> Can someone help me out with how to go about printing to a variable
> rather than to a file using filehandles. Below i have it in perl, how
> do i
> get this going in php. Thanks in advance...
>
> $string = '' ";
> open $writeto, '>>', \$string;
>
> foreach my $file(@array){
> print $writeto $file;
> }
>
Check out output buffering functions:
ob_start();
print "whatever";
print "something else";
$output = ob_get_clean();
Exactly the same functionality as in perl can be achieved using stream
wrappers. See example here:
http://www.php.net/manual/en/function.stream-wrapper-register.php
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
[Back to original message]
|