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) { $seed = array(); return array_reduce($item, function ($seed, $key_values) { return array_map(function ($value) { $seed[] = $value; }, $key_values); return $seed; }, $seed); }, $items); var_dump($new_items);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9C6H4
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%2F9C6H4%3A12%240'
   21     3        SEND_VAL                                                 ~3
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
   12     6        ASSIGN                                                   !1, $4
   22     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

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

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

End of function %00%7Bclosure%7D%2Fin%2F9C6H4%3A15%241

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

End of function %00%7Bclosure%7D%2Fin%2F9C6H4%3A16%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.35 ms | 1392 KiB | 19 Q