Re: [PHP] putting the result of PHP code into a string
Ok. Maybe a bad example. But what if it's a function, e.g. $id = 2; $code = td?php echo Func1($id) ?/td $html = someFunction($code); Now, $html should contain td{the result of the Func1 function}/td The reason why I want this is that I have a site where all the text on each side lies in a MySQL database, and I have a php script which shows the pages with a common header, footer, menu etc.. But I want the text to also contain php code which will be evaluated by the script! regards Morten Gjetanger Jason Stechschulte [EMAIL PROTECTED] skrev i melding [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Fri, Nov 09, 2001 at 10:33:39PM +0100, Morten Gjetanger wrote: 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 tdTest1/td $var = Test1; $code = td$var/td; $html = someFunction($code); Done. -- Jason Stechschulte [EMAIL PROTECTED] -- You can't have filenames longer than 14 chars. You can't even think about them! -- Larry Wall in Configure from the perl distribution -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: putting the result of PHP code into a string
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 [EMAIL PROTECTED] skrev i melding [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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 tdTest1/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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] putting the result of PHP code into a string
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 tdTest1/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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]