[thelist] Please help.. PHP guru's

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


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

Which I convert using:
html_entity_decode(stripslashes($str));

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

STAY ENCODED like:
<p>This is a paragraph</p>&lt;?php echo 'hello'; ?&gt;
[/snip]

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