Hi Rasmus,

file_gets_contents() doesn't work in my version of PHP (4.2.1). It says "not
a valid function" or something like that. Also, I discovered that the
filesize() function won't work on files fopened from the include_path. It
returns a value of zero, so, I had to hardcode the bytes into the fread().


> From: [EMAIL PROTECTED] (Rasmus Lerdorf)
> Newsgroups: php.general
> Date: Thu, 18 Jul 2002 15:14:13 -0700 (PDT)
> To: Analysis & Solutions <[EMAIL PROTECTED]>
> Cc: PHP List <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Loading a File into Variable - How??
> 
> 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
> 


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

Reply via email to