3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $substituir = array('FURG.','MEC.','MEC','AUT.','AUT','EXEC.','CONV.','SED.','INTERC.','EXPRES.','CLASS.','SED ','HAT.','PREM.','F.POWER','POW.','FLEXP.','ADVANT.','ECONOF.','ECONOFLEX','EXPRES.','TIP.','COMF.','COMF','T.FLEX','T. FLEX','TOT.FLEX','T. FIELD','TIPTRON','HIGHLI.','I MOTION','I-MOTI.','TIPTR','STRONIC','LUG.','EXCLUS.','EXCL.','SEDÃ','C.STYLE','C.PLUS','C./','LIMIT.','ELEG.','KOMP.','AVANTGARD','TOUR.','EXECUT.','AVANGARDE','EVOL.','EVOLUT.','INT.','BLIND.','INTERC.','CUPÊ','CUPÉ','COUPÊ','SED.','PRIV.','EXPRES.','EXP.','RANGE R.EVOQUE','DISCOVERY4','RANGE R.','FREELANDER2'); $novo = array('FURGÃO','MANUAL','MANUAL','AUTOMÁTICO','AUTOMÁTICO','EXECUTIVE','CONVERSÍVEL','SEDAN','INTERCOOLER','EXPRESSION','CLASSIC','SEDAN ','HATCH','PREMIUM','FLEXPOWER','POWER','FLEXPOWER','ADVANTAGE','ECONO.FLEX','ECONO.FLEX','EXPRESSION','TIPTRONIC','COMFORTLINE','COMFORTLINE','TOTAL FLEX','TOTAL FLEX','TOTAL FLEX','TRACK & FIELD','TIPTRONIC','HIGHLINE','I-MOTION','I-MOTION','TIPTRONIC','S-TRONIC','LUGARES','EXCLUSIVE','EXCLUSIVE','SEDAN','COMFORT STYLE','COMFORT PLUS','COMFORT/','LIMITED','ELEGANCE','KOMPRESSOR','AVANTGARDE','TOURING','EXECUTIVE','AVANTGARDE','EVOLUTION','EVOLUTION','INTERCOOLER','BLINDADO','INTERCOOLER','COUPÉ','COUPÉ','COUPÉ','SEDAN','PRIVILÈGE','EXPRESSION','EXPRESSION','RANGE ROVER EVOQUE','DISCOVERY 4','RANGE ROVER','FREELANDER 2'); for($i = 0; $i <count($substituir); $i++){ if(preg_match("/^([^\.]|([^\.])\.[^\.])*$/",$substituir[$i])) { $substituir[$i] = '#/' . $substituir[$i]. '/#i'; echo $substituir[$i]; } else { $substituir[$i] = '#\b(' . $substituir[$i] . ')\b#i'; echo $substituir[$i]; } } echo preg_replace($substituir,$novo,"CORSA SED CLASS.LIFE FLEXPOWER");
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
#\b(FURG.)\b#i#\b(MEC.)\b#i#/MEC/#i#\b(AUT.)\b#i#/AUT/#i#\b(EXEC.)\b#i#\b(CONV.)\b#i#\b(SED.)\b#i#\b(INTERC.)\b#i#\b(EXPRES.)\b#i#\b(CLASS.)\b#i#/SED /#i#\b(HAT.)\b#i#\b(PREM.)\b#i#/F.POWER/#i#\b(POW.)\b#i#\b(FLEXP.)\b#i#\b(ADVANT.)\b#i#\b(ECONOF.)\b#i#/ECONOFLEX/#i#\b(EXPRES.)\b#i#\b(TIP.)\b#i#\b(COMF.)\b#i#/COMF/#i#/T.FLEX/#i#/T. FLEX/#i#/TOT.FLEX/#i#/T. FIELD/#i#/TIPTRON/#i#\b(HIGHLI.)\b#i#/I MOTION/#i#\b(I-MOTI.)\b#i#/TIPTR/#i#/STRONIC/#i#\b(LUG.)\b#i#\b(EXCLUS.)\b#i#\b(EXCL.)\b#i#/SEDÃ/#i#/C.STYLE/#i#/C.PLUS/#i#/C.//#i#\b(LIMIT.)\b#i#\b(ELEG.)\b#i#\b(KOMP.)\b#i#/AVANTGARD/#i#\b(TOUR.)\b#i#\b(EXECUT.)\b#i#/AVANGARDE/#i#\b(EVOL.)\b#i#\b(EVOLUT.)\b#i#\b(INT.)\b#i#\b(BLIND.)\b#i#\b(INTERC.)\b#i#/CUPÊ/#i#/CUPÉ/#i#/COUPÊ/#i#\b(SED.)\b#i#\b(PRIV.)\b#i#\b(EXPRES.)\b#i#\b(EXP.)\b#i#/RANGE R.EVOQUE/#i#/DISCOVERY4/#i#\b(RANGE R.)\b#i#/FREELANDER2/#iCORSA SEDANCLASS.LIFE FLEXPOWER