'face=', 'size' => 'size=', 'color' => 'color='); $prependtags = $appendtags = ''; foreach($tags as $bbcode => $locate) { $optionvalue = fetchoptionvalue($locate, $fontoptions); if($optionvalue) { $prependtags .= "[$bbcode=$optionvalue]"; $appendtags = "[/$bbcode]$appendtags"; } } parsestyle($fontoptions, $prependtags, $appendtags); return $prependtags.recursion('font', $text, 'fonttag').$appendtags; } function getoptionvalue($option, $text) { preg_match("/$option(\s+?)?\=(\s+?)?[\"']?(.+?)([\"']|$|>)/is", $text, $matches); return isset($matches[3]) ? trim($matches[3]) : ''; } function html2bbcode($text) { $text = strip_tags($text, '