eval() question

From: Date: Wed, 21 Apr 2004 14:06:59 +0000
Subject: eval() question
Groups: php.general 
Request: Send a blank email to php-general+get-184126@lists.php.net to get a copy of this message
I would like to use eval() to evaluate another PHP file and store the output of that file in a string. So, let's say, for example, that I have a file called colors.php which contains this: <p>Colors: <? echo "Red, Yellow, Green, Blue"; ?></p> Then, in another file, I have this: $file = file_get_contents( "colors.php" ); $colors = eval( $file ); I'm having problems getting $file into $colors. How can I do this?

« previous php.general (#184126) next »