3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "/companies/(\d+)/adverts/new/(\d+)/"; $replace = array(2223, "?"); $result = vsprintf(preg_replace('#\(.*?\)#', '%s', $string, count($replace)), $replace); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cjr2Q
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string, !1 = $replace, !2 = $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%2F'
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'vsprintf'
          3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%23%5C%28.%2A%3F%5C%29%23'
          5        SEND_VAL                                                 '%25s'
          6        SEND_VAR                                                 !0
          7        COUNT                                            ~5      !1
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !2, $7
    7    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.88 ms | 1394 KiB | 19 Q