3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'sample {} test {} string {}'; $count = 0; echo preg_replace_callback("~{}~", function($m) use (&$count) { return '(' . $count++ . ')'; }, $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IDHlh
function name:  (null)
number of ops:  11
compiled vars:  !0 = $string, !1 = $count
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'sample+%7B%7D+test+%7B%7D+string+%7B%7D'
    4     1        ASSIGN                                                       !1, 0
    5     2        INIT_FCALL                                                   'preg_replace_callback'
          3        SEND_VAL                                                     '%7E%7B%7D%7E'
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
    7     6        SEND_VAL                                                     ~4
          7        SEND_VAR                                                     !0
    5     8        DO_ICALL                                             $5      
    7     9        ECHO                                                         $5
         10      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IDHlh
function name:  {closure:/in/IDHlh:5}
number of ops:  7
compiled vars:  !0 = $m, !1 = $count
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
    6     2        POST_INC                                             ~2      !1
          3        CONCAT                                               ~3      '%28', ~2
          4        CONCAT                                               ~4      ~3, '%29'
          5      > RETURN                                                       ~4
    7     6*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.02 ms | 1979 KiB | 14 Q