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><?

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to