Re: eval() question
| From: | OrangeHairedBoy | Date: | Wed, 21 Apr 2004 14:27:14 +0000 |
| Subject: | Re: eval() question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184131@lists.php.net to get a copy of this message | ||
Marek,
OK...that worked...kinda, but it doesn't pass the output to $colors. It
echos it. I need the output to be passed to $colors.
Lewis
"Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message
news:40868335.6060805@webglobe.sk...
> 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><?