Re: putting the result of PHP code into a string
| From: | Morten Gjetanger | Date: | Sat, 10 Nov 2001 16:45:49 +0000 |
| Subject: | Re: putting the result of PHP code into a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74108@lists.php.net to get a copy of this message | ||
Ok. To be a bit more precise. the $code part could be any php code, e.g.
$code = <<<ENDM
require_once("someFile.inc");
$array1 = someFunc1($param1);
foreach($array1 as $val) {
echo "<td>$val</td>\n";
}
ENDM;
regards
Morten Gjetanger
"Morten Gjetanger" <mortengj@yahoo.com> skrev i melding
news:20011109213619.53562.qmail@pb1.pair.com...
> I'm quite sure there is a simple solution to the problem bellow!
>
> I like to evaluate som PHP code, but I want the result to be putted into a
> string.
>
> example:
>
> $var = "Test1";
> $code = "<td><?php echo $var1?></td>";
> $html = someFunction($code);
>
> After this i want $html to contain "<td>Test1</td>
>
> I've checked the eval function, but it just evaluates the code and just
> outputs the result. I really wants the output into a string!
>
> regards
>
> Morten Gjetanger
>
>