3v4l.org

run code in 300+ PHP versions simultaneously
<?php $my_string = '1-a,2-b,3-c'; $my_array = array_map(function($val) {list($key,$value) = explode('-', $val); return [$key=>$value];}, explode(',', $my_string)); foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($my_array)) as $k=>$v){ $result[$k]=$v; } print_r($result); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/aYmOH
function name:  (null)
number of ops:  28
compiled vars:  !0 = $my_string, !1 = $my_array, !2 = $v, !3 = $k, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1-a%2C2-b%2C3-c'
    4     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          3        SEND_VAL                                                 ~6
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2C'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        SEND_VAR                                                 $7
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !1, $8
    5    11        NEW                                              $10     'RecursiveIteratorIterator'
         12        NEW                                              $11     'RecursiveArrayIterator'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
         15        SEND_VAR_NO_REF_EX                                       $11
         16        DO_FCALL                                      0          
         17      > FE_RESET_R                                       $14     $10, ->23
         18    > > FE_FETCH_R                                       ~15     $14, !2, ->23
         19    >   ASSIGN                                                   !3, ~15
    6    20        ASSIGN_DIM                                               !4, !3
         21        OP_DATA                                                  !2
    5    22      > JMP                                                      ->18
         23    >   FE_FREE                                                  $14
    9    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !4
         26        DO_ICALL                                                 
   11    27      > 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/aYmOH
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $val, !1 = $key, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '-'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        FETCH_LIST_R                                     $4      $3, 0
          6        ASSIGN                                                   !1, $4
          7        FETCH_LIST_R                                     $6      $3, 1
          8        ASSIGN                                                   !2, $6
          9        FREE                                                     $3
         10        INIT_ARRAY                                       ~8      !2, !1
         11      > RETURN                                                   ~8
         12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.41 ms | 1009 KiB | 16 Q