Show Your Support
$bbcodes=$DB_site->query("SELECT bbcodetag,bbcodereplacement,twoparams FROM bbcode"); while($bbregex=$DB_site->fetch_array($bbcodes)) { if ($bbregex[twoparams]) { $regex=sprintf($doubleRegex, $bbregex[bbcodetag], $bbregex[bbcodetag]); } else { $regex=sprintf($singleRegex, $bbregex[bbcodetag], $bbregex[bbcodetag]); } $searcharray[] = $regex; $replacearray[] = $bbregex[bbcodereplacement]; // and get nested ones: $searcharray[] = $regex; $replacearray[] = $bbregex[bbcodereplacement]; $searcharray[] = $regex; $replacearray[] = $bbregex[bbcodereplacement]; }
$bbcode=preg_replace($searcharray, $replacearray, $bbcode);