3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arrayBlacklist = ["Kota Administrasi", "Kota","Kab.","KAB", "KOTA", "Kabupaten"]; $trans = array_fill_keys($arrayBlacklist, ''); $cities = [ "Kota Jakarta Selatan", "Kota Administrasi Selatan", "Kab. What Kota Kab.", "KOTA Kota Coca Cola", ]; foreach ($cities as $city) { var_export( preg_replace('/\s{2,}/', ' ', trim(strtr($city, $trans))) ); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/PIiAq
function name:  (null)
number of ops:  20
compiled vars:  !0 = $arrayBlacklist, !1 = $trans, !2 = $cities, !3 = $city
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        INIT_FCALL                                                   'array_fill_keys'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     ''
          4        DO_ICALL                                             $5      
          5        ASSIGN                                                       !1, $5
    6     6        ASSIGN                                                       !2, <array>
   13     7      > FE_RESET_R                                           $8      !2, ->18
          8    > > FE_FETCH_R                                                   $8, !3, ->18
   14     9    >   INIT_FCALL                                                   'var_export'
   15    10        FRAMELESS_ICALL_2                strtr               ~9      !3, !1
         11        FRAMELESS_ICALL_1                trim                ~10     ~9
         12        FRAMELESS_ICALL_3                preg_replace        ~11     '%2F%5Cs%7B2%2C%7D%2F', '+'
         13        OP_DATA                                                      ~10
         14        SEND_VAL                                                     ~11
   14    15        DO_ICALL                                                     
   17    16        ECHO                                                         '%0A'
   13    17      > JMP                                                          ->8
         18    >   FE_FREE                                                      $8
   18    19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.39 ms | 1973 KiB | 15 Q