3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = ['a' => 'b']; $keys = ['a' => 'a']; function cb($v, $k){ return $v; } $start = microtime(true); print_r( array_map('cb', $ar, $keys) ); var_dump((microtime(true) - $start)*1000); $start = microtime(true); $foo = []; foreach($ar as $k => $v) $foo[$k] = call_user_func_array('cb', [$v, $k]); var_dump((microtime(true) - $start)*1000);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 39
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/KOM7d
function name:  (null)
number of ops:  49
compiled vars:  !0 = $ar, !1 = $keys, !2 = $start, !3 = $foo, !4 = $v, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !2, $8
    6     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'array_map'
          8        SEND_VAL                                                 'cb'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                                 
    7    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $12     
         18        SUB                                              ~13     $12, !2
         19        MUL                                              ~14     ~13, 1000
         20        SEND_VAL                                                 ~14
         21        DO_ICALL                                                 
    8    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $16     
         25        ASSIGN                                                   !2, $16
    9    26        ASSIGN                                                   !3, <array>
   10    27      > FE_RESET_R                                       $19     !0, ->39
         28    > > FE_FETCH_R                                       ~20     $19, !4, ->39
         29    >   ASSIGN                                                   !5, ~20
   11    30        INIT_FCALL                                               'cb'
         31        INIT_ARRAY                                       ~23     !4
         32        ADD_ARRAY_ELEMENT                                ~23     !5
         33        SEND_ARRAY                                               ~23
         34        CHECK_UNDEF_ARGS                                         
         35        DO_FCALL                                      0  $24     
         36        ASSIGN_DIM                                               !3, !5
         37        OP_DATA                                                  $24
   10    38      > JMP                                                      ->28
         39    >   FE_FREE                                                  $19
   12    40        INIT_FCALL                                               'var_dump'
         41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $25     
         44        SUB                                              ~26     $25, !2
         45        MUL                                              ~27     ~26, 1000
         46        SEND_VAL                                                 ~27
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Function cb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KOM7d
function name:  cb
number of ops:  4
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   !0
          3*     > RETURN                                                   null

End of function cb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.69 ms | 1403 KiB | 22 Q