Convert HTML to Entities or Entities to HTML

This is useful if you want to display your code to your website, blog or community forum.

<?php
$text = '<?php echo \'hello world\'; ?>';

$encode = htmlentities($text);

$decode = html_entity_decode($encode);

echo 'Encode '.$encode;
echo '<br />';
echo 'Decode '.$decode;
?>
PG

Author: insic

Subscribe in my RSS Feed for more updates on Web Design and Development related articles. Follow me on twitter or drop a message to my inbox.

Related Post

Delicious

No comments yet... Be the first to leave a reply!

Leave a Reply