RE: [PHP] putting the result of PHP code into a string

From: Date: Sun, 11 Nov 2001 01:45:38 +0000
Subject: RE: [PHP] putting the result of PHP code into a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74093@lists.php.net to get a copy of this message
$id = 2; $code = "<td>" . Func1($id) . "</td>" $html = someFunction($code); hope that helps! jessie -----Original Message----- From: Morten Gjetanger [mailto:mortengj@yahoo.com] Sent: Saturday, November 10, 2001 1:23 AM To: php-general@lists.php.net Subject: 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" <jpstech@unoh.edu> skrev i melding news:20011109165630.A27312@unwosrv5.unoh.edu... > 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 "<td>Test1</td> > > $var = "Test1"; > $code = "<td>$var</td>"; > $html = someFunction($code); > > Done. > > -- > Jason Stechschulte > jpstech@unoh.edu > -- > "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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net --- This incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001 --- This mail is certified Virus Free. No need to worry. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001

« previous php.general (#74093) next »