Re: how?

From: Date: Thu, 03 May 2001 12:41:03 +0000
Subject: Re: how?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51260@lists.php.net to get a copy of this message
On Thu, May 03, 2001 at 10:12:55AM -0700, elias wrote: > hello. > i read from a text file a line like: "Key=$value" > so, i do like: > $lines = join('', file("myfile.txt")); > echo $lines; > // output= Key=$value > Now how can i replace the values in the $lines variables? > i want like: > $value = "test"; > echo $lines; > and i want ouput like: Key=test > any idea? May not be the best way, but it works: <?php $lines = join('', file("myfile.txt")); $value = "test"; $lines = str_replace("\$value", $value, $lines); echo $lines; ?> -- Jason Stechschulte jpstech@unoh.edu -- Well, enough clowning around. Perl is, in intent, a cleaned up and summarized version of that wonderful semi-natural language known as "Unix". -- Larry Wall in <1994Apr6.184419.3687@netlabs.com>

« previous php.general (#51260) next »