PHP Escaping Special Characters – String Function

<?php
    $html = "<p> replace > and >> and >>> </p>";
    print "<b>Original text was: '" . $html . "'\n";
    $html = strrev( $html );    $newhtml = preg_replace( "/>(?![^><]+?\/?<)/", ";tl&", $html );
    $newhtml = strrev( $newhtml );
    print "<b>New text is: '" . $newhtml . "'\n";
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.