3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sample = array('a.col1','a.col2','b.col1','c.col1','c.col2','d.col5'); array_walk($sample, function($v) use (&$r){ $arr = explode('.', $v); $alias = isset($arr[0]) ? $arr[0] : ''; $r[$alias][] = isset($arr[1]) ? $arr[1] : ''; }); extract($r); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HSHcK
function name:  (null)
number of ops:  14
compiled vars:  !0 = $sample, !1 = $r, !2 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          4        BIND_LEXICAL                                             ~4, !1
    8     5        SEND_VAL                                                 ~4
    4     6        DO_ICALL                                                 
   10     7        INIT_FCALL                                               'extract'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
   11    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
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
Branch analysis from position: 19
filename:       /in/HSHcK
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $v, !1 = $r, !2 = $arr, !3 = $alias
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '.'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
    6     7        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 0
          8      > JMPZ                                                     ~6, ->12
          9    >   FETCH_DIM_R                                      ~7      !2, 0
         10        QM_ASSIGN                                        ~8      ~7
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~8      ''
         13    >   ASSIGN                                                   !3, ~8
    7    14        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 1
         15      > JMPZ                                                     ~12, ->19
         16    >   FETCH_DIM_R                                      ~13     !2, 1
         17        QM_ASSIGN                                        ~14     ~13
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~14     ''
         20    >   FETCH_DIM_W                                      $10     !1, !3
         21        ASSIGN_DIM                                               $10
         22        OP_DATA                                                  ~14
    8    23      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.89 ms | 1013 KiB | 17 Q