In 4.3 you would use file_get_contents()

In prior versions I would suggest:

$fp = fopen('filename','r');
$string = fread($fp, filesize('filename'));
fclose($fp);

The implode(file()) stuff is very memory-inefficient.

-Rasmus

On Thu, 18 Jul 2002, Analysis & Solutions wrote:

> On Thu, Jul 18, 2002 at 04:28:57PM -0400, Monty wrote:
> > > Look 4 implode() in the function list
> >
> > Implode isn't really what I need, I just want to load an entire file into a
> > single string variable.
>
> Yes, it IS what you need.  Plus, to work around your other problems
> mentioned in later posts...
>
>    $string = implode('', file('filename') );
>
> --Dan
>
> --
>                PHP classes that make web design easier
>         SQL Solution  |   Layout Solution   |  Form Solution
>     sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to