Re: vars in echoed file_get_contents string

From: Date: Sun, 01 Feb 2004 00:08:24 +0000
Subject: Re: vars in echoed file_get_contents string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176422@lists.php.net to get a copy of this message
Shawn McKenzie wrote:
I'm having a brain fart here: ---file.php $myvar = "Hello!"; $stuff = file_get_contents("file.html"); echo $stuff; ---file.html <b>$myvar</b> Any ideas why when $stuff is echoed I get $myvar and not Hello?
It's because you're echoing the contents of a variable, not evaluating it. Wasn't this already covered today, only pulling the string from a database? Either way, in your case you can simply say: include('file.html'); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#176422) next »