Re: eval() question

From: Date: Wed, 21 Apr 2004 14:20:37 +0000
Subject: Re: eval() question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184130@lists.php.net to get a copy of this message
OrangeHairedBoy wrote:
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?
eval starts in php mode by default, change the file content to ?><p>Colors: <? echo "Red, Yellow, Green, Blue"; ?></p><?

« previous php.general (#184130) next »