3v4l.org

run code in 300+ PHP versions simultaneously
<?php $substituir = array('MEC','AUT','SED','F.POWER','ECONOFLEX','COMF','T.FLEX','T. FLEX','TOT.FLEX','T. FIELD','TIPTRON','I MOTION','TIPTR','STRONIC','SEDÃ','C.STYLE','C.PLUS','C./','AVANTGARD','AVANGARDE','CUPÊ','CUPÉ','COUPÊ','RANGE R.EVOQUE','DISCOVERY4','FREELANDER2','FURG\\.','MEC\\.','AUT\\.','EXEC\\.','CONV\\.','SED\\.','INTERC.','EXPRES\\.','CLASS\\.','HAT\\.','PREM\\.','POW\\.','FLEXP\\.','ADVANT\\.','ECONOF\\.','EXPRES\\.','TIP\\.','COMF\\.','HIGHLI\\.','LUG\\.','EXCLUS\\.','EXCL\\.','LIMIT\\.','ELEG\\.','KOMP\\.','TOUR\\.','EXECUT\\.','EVOL\\.','EVOLUT\\.','INT.','BLIND\\.','INTERC\\.','SED\\.','PRIV\\.','EXPRES\\.','EXP\\.','RANGE R\\.'); $novo = array('MANUAL','AUTOMÁTICO','SEDAN','FLEXPOWER','ECONO.FLEX','COMFORTLINE','TOTAL FLEX','TOTAL FLEX','TOTAL FLEX','TRACK & FIELD','TIPTRONIC','I-MOTION','TIPTRONIC','S-TRONIC','SEDAN','COMFORT SYTLE','COMFORT PLUS','COMFORT','AVANTGARDE','AVANTGARDE','COUPÉ','COUPÉ','COUPÉ','RANGE ROVER EVOQUE','DISCOVERY 4','FREELANDER 2','FURGÃO','MANUAL','AUTOMÁTICO','EXECUTIVE','CONVERSÍVEL','SEDAN','INTERCOOLER','EXPRESSION','CLASSIC','HATCH','PREMIUM','POWER','FLEXPOWER','ADVANTAGE','ECONO.FLEX','EXPRESSION','TIPTRONIC','COMFORTLINE','HIGHLINE','LUGARES','EXCLUSIVE','EXCLUSIVE','LIMITED','ELEGANCE','KOMPRESSOR','TOURING','EXECUTIVE','EVOLUTION','EVOLUTION','INTERCOOLER','BLINDADO','INTERCOOLER','SEDAN','PRIVILÈGE','EXPRESSION','EXPRESSION','RANGE ROVER'); for($i = 0; $i <count($substituir); $i++){ if(strpos($substituir[$i],".") && substr($substituir[$i], -1) == '.') { echo substr($substituir[$i],-1); $substituir[$i] = '#' . $substituir[$i] . '#i'; } else { $substituir[$i] = '#\b(' . $substituir[$i] . ')\b#i'; } } echo preg_replace($substituir,$novo,'CELTA SPIRIT/ LT 1.0 MPFI 8V FLEXP. 5p');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 4
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 30
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 4
Branch analysis from position: 39
Branch analysis from position: 4
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 4
Branch analysis from position: 39
Branch analysis from position: 4
Branch analysis from position: 17
filename:       /in/gUDBE
function name:  (null)
number of ops:  46
compiled vars:  !0 = $substituir, !1 = $novo, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->36
    7     4    >   INIT_FCALL                                               'strpos'
          5        FETCH_DIM_R                                      ~6      !0, !2
          6        SEND_VAL                                                 ~6
          7        SEND_VAL                                                 '.'
          8        DO_ICALL                                         $7      
          9      > JMPZ_EX                                          ~8      $7, ->17
         10    >   INIT_FCALL                                               'substr'
         11        FETCH_DIM_R                                      ~9      !0, !2
         12        SEND_VAL                                                 ~9
         13        SEND_VAL                                                 -1
         14        DO_ICALL                                         $10     
         15        IS_EQUAL                                         ~11     $10, '.'
         16        BOOL                                             ~8      ~11
         17    > > JMPZ                                                     ~8, ->30
    9    18    >   INIT_FCALL                                               'substr'
         19        FETCH_DIM_R                                      ~12     !0, !2
         20        SEND_VAL                                                 ~12
         21        SEND_VAL                                                 -1
         22        DO_ICALL                                         $13     
         23        ECHO                                                     $13
   10    24        FETCH_DIM_R                                      ~15     !0, !2
         25        CONCAT                                           ~16     '%23', ~15
         26        CONCAT                                           ~17     ~16, '%23i'
         27        ASSIGN_DIM                                               !0, !2
         28        OP_DATA                                                  ~17
         29      > JMP                                                      ->35
   12    30    >   FETCH_DIM_R                                      ~19     !0, !2
         31        CONCAT                                           ~20     '%23%5Cb%28', ~19
         32        CONCAT                                           ~21     ~20, '%29%5Cb%23i'
         33        ASSIGN_DIM                                               !0, !2
         34        OP_DATA                                                  ~21
    6    35    >   PRE_INC                                                  !2
         36    >   COUNT                                            ~23     !0
         37        IS_SMALLER                                               !2, ~23
         38      > JMPNZ                                                    ~24, ->4
   16    39    >   INIT_FCALL                                               'preg_replace'
         40        SEND_VAR                                                 !0
         41        SEND_VAR                                                 !1
         42        SEND_VAL                                                 'CELTA+SPIRIT%2F+LT+1.0+MPFI+8V+FLEXP.+5p'
         43        DO_ICALL                                         $25     
         44        ECHO                                                     $25
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.81 ms | 1405 KiB | 19 Q