[thelist] Please help.. PHP guru's

Kasimir K evolt at kasimir-k.fi
Thu Feb 24 07:49:24 CST 2005


> 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;

The easiest might be that after html_entity_decode you just replace 
'<?php' and '?>' with '&lt;?php' and '?&gt' using str_replace().

.k



More information about the thelist mailing list