3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = array('phrase', 'fruit'); $ar = ['a'=>'apple', 'b'=>'banana', 'c'=>'pear']; $new_ar = array_map(function ($v, $k) use ($keys) { return array_combine($keys, array($k, $v)); }, $ar, array_keys($ar)); print_r($new_ar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6KlUA
function name:  (null)
number of ops:  17
compiled vars:  !0 = $keys, !1 = $ar, !2 = $new_ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          4        BIND_LEXICAL                                             ~5, !0
    8     5        SEND_VAL                                                 ~5
          6        SEND_VAR                                                 !1
          7        INIT_FCALL                                               'array_keys'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
    6    11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !2, $7
   10    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > 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/6KlUA
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $v, !1 = $k, !2 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        INIT_FCALL                                               'array_combine'
          4        SEND_VAR                                                 !2
          5        INIT_ARRAY                                       ~3      !1
          6        ADD_ARRAY_ELEMENT                                ~3      !0
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
    8    10*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.89 ms | 957 KiB | 17 Q