Page 1 of 1

PHP within TEXT in a database

Posted: Fri Jan 10, 2003 9:03 pm
by Gen-ik
I'm not sure if this is possible, if it is I'm guessing it has something to do with using Eval().

Let's say I have some text in a database which looks something like this..

"Hello. My name is Bob and I've been here <?php a_function('Bob'); ?> times since I started."

Is it possible to run the PHP part of this before the text gets Echo()'ed to the page without having to split up the whole string of text to find any PHP within it?

Posted: Sun Jan 12, 2003 7:29 am
by bender
Dunno for sure, but perhaps printf() instead of echo"" might be useful?

Post the solution if you find one - I'm keen to know myself :)

Posted: Mon Jan 13, 2003 11:06 am
by superwormy
eval ("?>" . $texttoevaluateandsendtopage . "<?php");

Posted: Mon Jan 13, 2003 12:17 pm
by Gen-ik
superwormy wrote:eval ("?>" . $texttoevaluateandsendtopage . "<?php");
Fantastic! Cheers mate.