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) { return 'h'; }, $string); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Wutp
function name:  (null)
number of ops:  15
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%2F7Wutp%3A6%240'
    8     7        SEND_VAL                                                 ~7
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $8      
    6    10        ASSIGN                                                   !2, $8
   10    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.13 ms | 1395 KiB | 17 Q