3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "/companies/(?)/adverts/new/(?)"; $replace = array(2223, 'generic'); $result = preg_replace_callback('#(\(\?\))#', function($m) use ($replace) { return 'h'; }, $string); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AeYKQ
function name:  (null)
number of ops:  14
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%3F%29%2Fadverts%2Fnew%2F%28%3F%29'
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%23%28%5C%28%5C%3F%5C%29%29%23'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAeYKQ%3A6%240'
          5        BIND_LEXICAL                                             ~5, !1
    8     6        SEND_VAL                                                 ~5
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
    6     9        ASSIGN                                                   !2, $6
   10    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAeYKQ%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AeYKQ
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $m, !1 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    7     2      > RETURN                                                   'h'
    8     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAeYKQ%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.03 ms | 1395 KiB | 17 Q