[thelist] Please help.. PHP guru's

Jay Blanchard jay.blanchard at niicommunications.com
Thu Feb 24 07:36:41 CST 2005

I have a string:
$str = '<p>This is a paragraph<p><?php echo \'hello\'; 

Which I convert using:

Which result in:
<p>This is a paragraph</p><?php echo 'hello'; ?>

But.. I need to manipulate the string in such a way that the PHP tags to

<p>This is a paragraph</p>&lt;?php echo 'hello'; ?&gt;

This is just a bad way to code this, especially if you plan to echo the
string $str ...why are you embedding another set of PHP tags? But to do
it use single quotes...

$str = '<p>This is a paragraph</p>&lt;?php echo \'hello\'; ?&gt;';
echo $str;

More information about the thelist mailing list