3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/([a-z]+)\[(\d+),(\d+)]/i'; $str = 'Mon[3,9] Tue[3,9] Wed[5,9] Thu[5,11] Fri[5,11] Sat[5,11] Sun[4,10]'; $result = []; preg_replace_callback( $pattern, function ($m) use (&$result) { $result[$m[1]] = [$m[2], $m[3]]; }, $str ); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c8h01
function name:  (null)
number of ops:  14
compiled vars:  !0 = $pattern, !1 = $str, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28%5Ba-z%5D%2B%29%5C%5B%28%5Cd%2B%29%2C%28%5Cd%2B%29%5D%2Fi'
    4     1        ASSIGN                                                   !1, 'Mon%5B3%2C9%5D+Tue%5B3%2C9%5D+Wed%5B5%2C9%5D+Thu%5B5%2C11%5D+Fri%5B5%2C11%5D+Sat%5B5%2C11%5D+Sun%5B4%2C10%5D'
    5     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'preg_replace_callback'
    8     4        SEND_VAR                                                 !0
    9     5        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          6        BIND_LEXICAL                                             ~6, !2
   11     7        SEND_VAL                                                 ~6
   12     8        SEND_VAR                                                 !1
    7     9        DO_ICALL                                                 
   15    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > 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/c8h01
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $m, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        FETCH_DIM_R                                      ~2      !0, 1
          3        FETCH_DIM_R                                      ~4      !0, 2
          4        INIT_ARRAY                                       ~5      ~4
          5        FETCH_DIM_R                                      ~6      !0, 3
          6        ADD_ARRAY_ELEMENT                                ~5      ~6
          7        ASSIGN_DIM                                               !1, ~2
          8        OP_DATA                                                  ~5
   11     9      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.65 ms | 1003 KiB | 15 Q