3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array ( "group_name_1" => "audi", "group_locations_1" => "tokyo,barcelona,paris", "group_quantities_at_locations_1" => "1,2,7", "group_name_2" => "ford", "group_locations_2" => "london,prag", "group_quantities_at_locations_2" => "3,6" ); $result = []; $function = function($v) use (&$result){ $result[$v[0]] = array_combine(explode(",",$v[1]),explode(",",$v[2])); }; array_walk(array_chunk($input,3),$function); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eTjtp
function name:  (null)
number of ops:  17
compiled vars:  !0 = $input, !1 = $result, !2 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   14     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeTjtp%3A14%240'
          3        BIND_LEXICAL                                             ~5, !1
          4        ASSIGN                                                   !2, ~5
   17     5        INIT_FCALL                                               'array_walk'
          6        INIT_FCALL                                               'array_chunk'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 3
          9        DO_ICALL                                         $7      
         10        SEND_VAR_NO_REF                               0          $7
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   19    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeTjtp%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eTjtp
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $v, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   15     2        FETCH_DIM_R                                      ~2      !0, 0
          3        INIT_FCALL                                               'array_combine'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2C'
          6        FETCH_DIM_R                                      ~4      !0, 1
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '%2C'
         12        FETCH_DIM_R                                      ~6      !0, 2
         13        SEND_VAL                                                 ~6
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        ASSIGN_DIM                                               !1, ~2
         18        OP_DATA                                                  $8
   16    19      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeTjtp%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.51 ms | 1388 KiB | 23 Q