Re: Implode slows down file reading? [was: str_replace performance in large mailing script]

From: Date: Wed, 27 Aug 2003 15:06:02 +0000
Subject: Re: Implode slows down file reading? [was: str_replace performance in large mailing script]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160921@lists.php.net to get a copy of this message
From: "frederik feys" <frederikfeys@pandora.be> > I thought str_replace caused slow down of my mailing script, but it > seems to be this line of code: > > $fd = > > implode("",file("http://www.domain.org/store/min/Mailing_template.html") > ); > > I first put the mailing template in $fd (only once) and then replace > (str_replace) elements of it to individualize HTML emails. > Btw i'm using php version 4.0.6. > > Are there better(faster) ways to read the contents of a file? file_get_contents() ? The slow down is probably because you're going through HTTP to read the file. Is there a reason for that? Any way you can cache the file locally so it's not read through HTTP all of the time? ---John Holmes...

« previous php.general (#160921) next »