3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo ', array_walk: '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array/*, array_keys($array)*/); } echo ', array_map: '.(microtime(true) - $t).'\n';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 38
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 57
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 57
Branch analysis from position: 64
Branch analysis from position: 57
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 38
Branch analysis from position: 45
Branch analysis from position: 38
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
Branch analysis from position: 14
Branch analysis from position: 22
filename:       /in/loq6A
function name:  (null)
number of ops:  72
compiled vars:  !0 = $iter, !1 = $array, !2 = $function, !3 = $t, !4 = $i, !5 = $val, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    5     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Floq6A%3A5%240'
          7        ASSIGN                                                   !2, ~10
    7     8        INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !3, $12
    8    12        ASSIGN                                                   !4, 0
         13      > JMP                                                      ->24
   10    14    > > FE_RESET_R                                       $15     !1, ->22
         15    > > FE_FETCH_R                                       ~16     $15, !5, ->22
         16    >   ASSIGN                                                   !6, ~16
   12    17        INIT_DYNAMIC_CALL                                        !2
         18        SEND_VAR_EX                                              !5
         19        SEND_VAR_EX                                              !6
         20        DO_FCALL                                      0          
   10    21      > JMP                                                      ->15
         22    >   FE_FREE                                                  $15
    8    23        PRE_INC                                                  !4
         24    >   IS_SMALLER                                               !4, !0
         25      > JMPNZ                                                    ~20, ->14
   15    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $21     
         29        SUB                                              ~22     $21, !3
         30        CONCAT                                           ~23     'foreach%3A+', ~22
         31        ECHO                                                     ~23
   17    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $24     
         35        ASSIGN                                                   !3, $24
   18    36        ASSIGN                                                   !4, 0
         37      > JMP                                                      ->43
   20    38    >   INIT_FCALL                                               'array_walk'
         39        SEND_REF                                                 !1
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                                 
   18    42        PRE_INC                                                  !4
         43    >   IS_SMALLER                                               !4, !0
         44      > JMPNZ                                                    ~29, ->38
   22    45    >   INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $30     
         48        SUB                                              ~31     $30, !3
         49        CONCAT                                           ~32     '%2C+array_walk%3A+', ~31
         50        ECHO                                                     ~32
   24    51        INIT_FCALL                                               'microtime'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $33     
         54        ASSIGN                                                   !3, $33
   25    55        ASSIGN                                                   !4, 0
         56      > JMP                                                      ->62
   27    57    >   INIT_FCALL                                               'array_map'
         58        SEND_VAR                                                 !2
         59        SEND_VAR                                                 !1
         60        DO_ICALL                                                 
   25    61        PRE_INC                                                  !4
         62    >   IS_SMALLER                                               !4, !0
         63      > JMPNZ                                                    ~38, ->57
   29    64    >   INIT_FCALL                                               'microtime'
         65        SEND_VAL                                                 <true>
         66        DO_ICALL                                         $39     
         67        SUB                                              ~40     $39, !3
         68        CONCAT                                           ~41     '%2C+array_map%3A+', ~40
         69        CONCAT                                           ~42     ~41, '%5Cn'
         70        ECHO                                                     ~42
         71      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Floq6A%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/loq6A
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $val, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Floq6A%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.26 ms | 1404 KiB | 21 Q