3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'aktuell/blog/cat1/cat2/cat3'; $uri_arr = explode("/",$str); $cat = array(); array_map(function($v) use (&$cat){ preg_match('/^cat\d$/',$v,$matches); if(count($matches) > 0){ $cat[] = $matches[0]; } },$uri_arr); print_r($cat);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QS09q
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str, !1 = $uri_arr, !2 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aktuell%2Fblog%2Fcat1%2Fcat2%2Fcat3'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        ASSIGN                                                   !2, <array>
    6     7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          9        BIND_LEXICAL                                             ~7, !2
   11    10        SEND_VAL                                                 ~7
         11        SEND_VAR                                                 !1
    6    12        DO_ICALL                                                 
   12    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/QS09q
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $v, !1 = $cat, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    7     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5Ecat%5Cd%24%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    8     7        COUNT                                            ~4      !2
          8        IS_SMALLER                                               0, ~4
          9      > JMPZ                                                     ~5, ->13
    9    10    >   FETCH_DIM_R                                      ~7      !2, 0
         11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  ~7
   11    13    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
261.65 ms | 1006 KiB | 17 Q