3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '#\d+#'; $haystack = '0123 456 789'; echo preg_replace_callback($pattern, 'add_three', $haystack); function add_three($matches){ return '-'.$matches[0].'-'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tTpYf
function name:  (null)
number of ops:  9
compiled vars:  !0 = $pattern, !1 = $haystack
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%23%5Cd%2B%23'
    4     1        ASSIGN                                                   !1, '0123+456+789'
    6     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'add_three'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        ECHO                                                     $4
   10     8      > RETURN                                                   1

Function add_three:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tTpYf
function name:  add_three
number of ops:  6
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_DIM_R                                      ~1      !0, 0
          2        CONCAT                                           ~2      '-', ~1
          3        CONCAT                                           ~3      ~2, '-'
          4      > RETURN                                                   ~3
   10     5*     > RETURN                                                   null

End of function add_three

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.04 ms | 1395 KiB | 15 Q