3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 12 => "USD", 13 => "10150.00", 14 => "9850.00", 15 => "SGD", 16 => "8015.40", 17 => "7915.40", 18 => "HKD", 19 => "1304.60", 20 => "1288.60" ]; var_export( array_reduce( array_chunk($input, 3), function($carry, $item) { $carry[$item[0]] = ["Buy" => $item[1], "Sell" => $item[2]]; return $carry; }, [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mjkus
function name:  (null)
number of ops:  15
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'var_export'
   16     2        INIT_FCALL                                               'array_reduce'
   17     3        INIT_FCALL                                               'array_chunk'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 3
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
   18     8        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   21     9        SEND_VAL                                                 ~3
   22    10        SEND_VAL                                                 <array>
   16    11        DO_ICALL                                         $4      
   22    12        SEND_VAR                                                 $4
   15    13        DO_ICALL                                                 
   24    14      > 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/Mjkus
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_DIM_R                                      ~2      !1, 0
          3        FETCH_DIM_R                                      ~4      !1, 1
          4        INIT_ARRAY                                       ~5      ~4, 'Buy'
          5        FETCH_DIM_R                                      ~6      !1, 2
          6        ADD_ARRAY_ELEMENT                                ~5      ~6, 'Sell'
          7        ASSIGN_DIM                                               !0, ~2
          8        OP_DATA                                                  ~5
   20     9      > RETURN                                                   !0
   21    10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.96 ms | 1069 KiB | 16 Q