3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "/companies/(\d+)/adverts/new/(\d+)"; preg_match_all('#\((.*?)\)#', $string, $matches); $search = $matches[0]; $replace = array(2223, 1111); $result = strtr($string, array_combine($search, $replace)); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lk0mh
function name:  (null)
number of ops:  22
compiled vars:  !0 = $string, !1 = $matches, !2 = $search, !3 = $replace, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fcompanies%2F%28%5Cd%2B%29%2Fadverts%2Fnew%2F%28%5Cd%2B%29'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%23%5C%28%28.%2A%3F%29%5C%29%23'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    7     6        FETCH_DIM_R                                      ~7      !1, 0
          7        ASSIGN                                                   !2, ~7
    8     8        ASSIGN                                                   !3, <array>
   10     9        INIT_FCALL                                               'strtr'
         10        SEND_VAR                                                 !0
         11        INIT_FCALL                                               'array_combine'
         12        SEND_VAR                                                 !2
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !4, $11
   12    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.11 ms | 1395 KiB | 21 Q