3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = array( array( array("Color" => "Blue"), array("Size" => "S") ), array( array("Color" => "Blue"), array("Size" => "M") ) ); $new_items = array_map(function ($item) { return array_reduce($item, function ($seed, $key_values) { return array_map(function ($value) { $seed[] = $value; }, $key_values); return $seed; }, array()); }, $items); var_dump($new_items);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nsAUU
function name:  (null)
number of ops:  11
compiled vars:  !0 = $items, !1 = $new_items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnsAUU%3A12%240'
   19     3        SEND_VAL                                                 ~3
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
   12     6        ASSIGN                                                   !1, $4
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FnsAUU%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nsAUU
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnsAUU%3A13%241'
   18     4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 <array>
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   19     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnsAUU%3A12%240

Function %00%7Bclosure%7D%2Fin%2FnsAUU%3A13%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nsAUU
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $seed, !1 = $key_values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnsAUU%3A14%242'
   16     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   17     8*       RETURN                                                   !0
   18     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnsAUU%3A13%241

Function %00%7Bclosure%7D%2Fin%2FnsAUU%3A14%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nsAUU
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $value, !1 = $seed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ASSIGN_DIM                                               !1
          2        OP_DATA                                                  !0
   16     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnsAUU%3A14%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.17 ms | 1392 KiB | 19 Q