3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'ê[B]éîøoo[/B]åaí'; $isMatch = preg_match( '/\[(\w++)([=]?)([^\]]*?)\]([^\[]*?)\[\/\1\]|\[(HR|\*)\]/', $string, $matches ); if($isMatch) { echo str_replace( "[{$matches[1]}]{$matches[4]}[/{$matches[1]}]", $tag, $string ); }
based on mrVSC
Output for 5.0.4 - 5.6.28, 7.0.20, 7.1.5 - 7.2.0
Notice: Undefined variable: tag in /in/mQFkX on line 13 êåaí
Output for 7.0.0 - 7.0.14, 7.1.0
Notice: Undefined variable: tag in /in/mQFkX on line 12 êåaí
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: tag in /in/mQFkX on line 13 êåaí