As u are good in regular expression you might help me in this code
$news="<font class=\"cool\">Text</font>
<b>Hi, this is another text with bold style</b>
<a href=\"http://www.google.com\"><font class=cool>Text</font></a>
";
$test=changeChar('<font class="cool">','</font>',$news);
Out put
$output="<font class=\"cool\">SDS</font>
<b>Hi, this is another text with bold style</b>
<a href=\"http://www.google.com\"><font class=cool>SDS</font></a";
Testing code
function changeChar($start="",$end="",$str){
//Rule
//Never ever convert any html tag
//if $start and $end is empty covert all character,mass convert
//If specified $startphrase and endphrase then convert all character between them.
$array=array(
'T'=>'s',
'x='='D',
't'='S');
//More will be added
$final="";
$data = preg_split('#(<\/?)(\w+)([^>]*>)#mis',$str);
preg_match_all('#(<\/?)(\w+)([^>]*>)#mis',$str,$matches);
$temp = array();
foreach($data as $text){
$temp[] = strtr($text,$array);
}
for($i=0;$i<sizeof($temp);$i++){
$final .= $temp[$i].$matches[0][$i];
}
}
I think its better then old style.
Sorry for taking your time. Your help would be very helpfull.
Regards