3v4l.org

run code in 300+ 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 = 26
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/PIiAq
function name:  (null)
number of ops:  28
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, ->26
          8    > > FE_FETCH_R                                               $8, !3, ->26
   14     9    >   INIT_FCALL                                               'var_export'
   15    10        INIT_FCALL                                               'preg_replace'
         11        SEND_VAL                                                 '%2F%5Cs%7B2%2C%7D%2F'
         12        SEND_VAL                                                 '+'
         13        INIT_FCALL                                               'trim'
         14        INIT_FCALL                                               'strtr'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                         $11     
         22        SEND_VAR                                                 $11
   14    23        DO_ICALL                                                 
   17    24        ECHO                                                     '%0A'
   13    25      > JMP                                                      ->8
         26    >   FE_FREE                                                  $8
   18    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
244.94 ms | 1003 KiB | 18 Q