Jump to content

How to get this code working?


lopes_andre

Recommended Posts

Hi, I need to put some php code inside variables. It is possible?

 

<?php

/**
* @author duioi
* @copyright 2009
*/

$part1 =  'echo "11111";';

$part2 = 'echo "22222";';

?>

<table width="653" border="0" align="center">
   <tr>
    	<td width="124"><?php $part1 ?></td>
    	<td width="431"><?php $part2 ?></td>
  </tr>
</table>

 

This code is not working. But I don't know why. How to get this working?

 

Best Regards.

André.

Link to comment
https://forums.phpfreaks.com/topic/140309-how-to-get-this-code-working/
Share on other sites

You could use eval to do that, but you're going about it the wrong way.

 

 

<?php

$part1 =  '11111';

$part2 = '22222';

?>

<table width="653" border="0" align="center">
   <tr>
       <td width="124"><?php echo $part1 ?></td>
       <td width="431"><?php echo $part2 ?></td>
  </tr>
</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.