3v4l.org

run code in 150+ 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 7.0.0 - 7.1.0
Notice: Undefined variable: tag in /in/mQFkX on line 12 êåaí
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: tag in /in/mQFkX on line 15 êåaí
Output for 5.0.4 - 5.6.28
Notice: Undefined variable: tag in /in/mQFkX on line 13 êåaí
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: tag in /in/mQFkX on line 13 êåaí