3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array('country1' => 'CountryOne', 'country2' => 'Country Two'); print_r($input); $output = array_map(function($each) { return array('code' => key($each), 'name' => current($each)); }, array_chunk($input, 1, true)); print_r($output); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Xg6t
function name:  (null)
number of ops:  19
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'array_map'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        SEND_VAL                                                 ~4
          7        INIT_FCALL                                               'array_chunk'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 1
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !1, $6
    7    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
    9    18      > 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/9Xg6t
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $each
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'key'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        INIT_ARRAY                                       ~2      $1, 'code'
          5        INIT_FCALL                                               'current'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        ADD_ARRAY_ELEMENT                                ~2      $3, 'name'
          9      > RETURN                                                   ~2
         10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.62 ms | 1010 KiB | 18 Q