To Replace carriage return with “< br >” tag
Thursday, November 22nd, 2007carriage return==>13(ascii value)
line feed ===>10(ascii value)
This function is used to replace a carriage return with < br > tag.
The ord() function returns the ASCII value of each character.
To check ascii value of each chracter if it is 13(ascii value) it will replace with
<br> tag.If it is 10(ascii value) it will replace with “” tag.
function call
$temp=check_alphabets($str);
function definition
function check_alphabets($str){
for($i=0;$i<strlen($str);$i++)
{
$chara=ord($str[$i]);
if($chara==13)
$str=str_replace($str[$i],”<br>”,$str);
if($chara==10)
$str=str_replace($str[$i],”",$str);
}
return $str;
}
Posted by Kalaivani S