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); $start = microtime(true); $foo = []; foreach($ar as $k => $v) $foo[$k] = call_user_func_array('cb', [$v, $k]); var_dump(microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 38
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/2UGbh
function name:  (null)
number of ops:  47
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        SEND_VAL                                                 ~13
         20        DO_ICALL                                                 
    8    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !2, $15
    9    25        ASSIGN                                                   !3, <array>
   10    26      > FE_RESET_R                                       $18     !0, ->38
         27    > > FE_FETCH_R                                       ~19     $18, !4, ->38
         28    >   ASSIGN                                                   !5, ~19
   11    29        INIT_FCALL                                               'cb'
         30        INIT_ARRAY                                       ~22     !4
         31        ADD_ARRAY_ELEMENT                                ~22     !5
         32        SEND_ARRAY                                               ~22
         33        CHECK_UNDEF_ARGS                                         
         34        DO_FCALL                                      0  $23     
         35        ASSIGN_DIM                                               !3, !5
         36        OP_DATA                                                  $23
   10    37      > JMP                                                      ->27
         38    >   FE_FREE                                                  $18
   12    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $24     
         43        SUB                                              ~25     $24, !2
         44        SEND_VAL                                                 ~25
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Function cb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2UGbh
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:
149.84 ms | 1403 KiB | 22 Q