- #1
chrisalviola
- 80
- 0
I have this PHP code to edit all HTML text to be displayed so that it won't appear as HTML but as standard text.
<?php
function htmlformat($sinput){
$newphrase = str_replace("<", "<", $sinput);
$newphrase = str_replace(">", ">", $newphrase);
$newphrase = str_replace(chr(13),"<br>",$newphrase);
$newphrase = str_replace(chr(34), """, $newphrase);
$newphrase = str_replace(chr(32), " ",$newphrase);$newphrase=str_replace("","<font color=red>",$newphrase);
$newphrase=str_replace("","</font>",$newphrase);
$newphrase=str_replace("","<img src=",$newphrase);
$newphrase=str_replace("",">",$newphrase);return $newphrase;
}
?>the problem is this part of the code
$newphrase = str_replace(chr(32), " ",$newphrase);it only replace the single spaces with
but what about multiple spaces?
when I have 2 more spaces on the text it can't seem to replace it with
<?php
function htmlformat($sinput){
$newphrase = str_replace("<", "<", $sinput);
$newphrase = str_replace(">", ">", $newphrase);
$newphrase = str_replace(chr(13),"<br>",$newphrase);
$newphrase = str_replace(chr(34), """, $newphrase);
$newphrase = str_replace(chr(32), " ",$newphrase);$newphrase=str_replace("","<font color=red>",$newphrase);
$newphrase=str_replace("","</font>",$newphrase);
$newphrase=str_replace("","<img src=",$newphrase);
$newphrase=str_replace("",">",$newphrase);return $newphrase;
}
?>the problem is this part of the code
$newphrase = str_replace(chr(32), " ",$newphrase);it only replace the single spaces with
but what about multiple spaces?
when I have 2 more spaces on the text it can't seem to replace it with