3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ "pentrose_50_rafhan_c_kgs" => 100, "pentrose_50_rafhan_c_issued_kgs" => 300, "pentrose_50_rafhan_c_rskg" => 99.1, "pentrose_50_rafhan_c_amount" => 29730, ]; $newArray[explode('_c_', current(($keys = array_keys($array))))[0]] = array_map(fn($key) => [explode('_c_', $key)[1] => $array[$key]], $keys); var_dump($newArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DhmsU
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $newArray, !2 = $keys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '_c_'
          3        INIT_FCALL                                                   'current'
          4        INIT_FCALL                                                   'array_keys'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $4      
          7        ASSIGN                                               ~5      !2, $4
          8        SEND_VAL                                                     ~5
          9        DO_ICALL                                             $6      
         10        SEND_VAR                                                     $6
         11        DO_ICALL                                             $7      
         12        FETCH_DIM_R                                          ~8      $7, 0
         13        INIT_FCALL                                                   'array_map'
         14        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
         15        BIND_LEXICAL                                                 ~10, !0
         16        SEND_VAL                                                     ~10
         17        SEND_VAR                                                     !2
         18        DO_ICALL                                             $11     
         19        ASSIGN_DIM                                                   !1, ~8
         20        OP_DATA                                                      $11
   12    21        INIT_FCALL                                                   'var_dump'
         22        SEND_VAR                                                     !1
         23        DO_ICALL                                                     
         24      > 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/DhmsU
function name:  {closure:/in/DhmsU:10}
number of ops:  11
compiled vars:  !0 = $key, !1 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '_c_'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $2      
          6        FETCH_DIM_R                                          ~3      $2, 1
          7        FETCH_DIM_R                                          ~4      !1, !0
          8        INIT_ARRAY                                           ~5      ~4, ~3
          9      > RETURN                                                       ~5
         10*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.7 ms | 1919 KiB | 18 Q