3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "/companies/(\d+)/adverts/new/(\d+)"; $replace = array(2223, 'generic'); $result = preg_replace_callback('#'.$string.'#', 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/MoZuT
function name:  (null)
number of ops:  16
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'
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'preg_replace_callback'
          3        CONCAT                                           ~5      '%23', !0
          4        CONCAT                                           ~6      ~5, '%23'
          5        SEND_VAL                                                 ~6
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMoZuT%3A6%240'
          7        BIND_LEXICAL                                             ~7, !1
    8     8        SEND_VAL                                                 ~7
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $8      
    6    11        ASSIGN                                                   !2, $8
   10    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FMoZuT%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MoZuT
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%2FMoZuT%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.4 ms | 1395 KiB | 17 Q