Can't use "font" word in php
I wanna make some MyCodes for the editor of my script. I was defined this
function and it works correctly:
function preg($txt,$pattern,$output) {
$pattern = str_replace("[","\[",$pattern);
$pattern = str_replace("]","\]",$pattern);
while(preg_match($pattern, $txt)) { $txt = preg_replace($pattern, $output,
$txt); }
return $txt;
}
Also all these codes are work well:
$txt = preg($txt,'#[url=(.*)](.*)[/url]#','<a href="$1">$2</a>');
$txt = preg($txt,'#[url](.*)[/url]#','<a href="$1">$1</a>');
$txt = preg($txt,'#[img](.*)[/img]#','<img src="$1">');
But I can't use font word in my MyCode:
$txt = preg($txt,'#[font=(.*?)](.*?)[/font]#','<span
style="font-family:$1">$2</span>');
Such that I can not even replace an string it have font word! for example:
$content = str_ireplace("font","fnt",$content);
... And it doesn't work.
At the end I test this code and I see the result:
$txt = preg($txt,'#[fnt=(.*?)](.*?)[/fnt]#','<span
style="font-family:$1">$2</span>');
How can I fix it?
Thank you
No comments:
Post a Comment