3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(0, 50000); $n = 300; $t = microtime(true); for ($i = 0; $i < $n; $i++) { foreach ($array as $v) { } } var_dump(microtime(true) - $t); $t = microtime(true); for ($i = 0; $i < $n; $i++) { for ($j = 0, $c = count($array); $j < $c; $j++) { $v = $array[$j]; } } var_dump(microtime(true) - $t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 12
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 32
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 36
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 32
Branch analysis from position: 44
Branch analysis from position: 32
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 36
Branch analysis from position: 41
Branch analysis from position: 36
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 12
Branch analysis from position: 19
Branch analysis from position: 12
Branch analysis from position: 15
filename:       /in/UYaFY
function name:  (null)
number of ops:  52
compiled vars:  !0 = $array, !1 = $n, !2 = $t, !3 = $i, !4 = $v, !5 = $j, !6 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 50000
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    5     5        ASSIGN                                                   !1, 300
    7     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !2, $10
    8    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->17
    9    12    > > FE_RESET_R                                       $13     !0, ->15
         13    > > FE_FETCH_R                                               $13, !4, ->15
         14    > > JMP                                                      ->13
         15    >   FE_FREE                                                  $13
    8    16        PRE_INC                                                  !3
         17    >   IS_SMALLER                                               !3, !1
         18      > JMPNZ                                                    ~15, ->12
   11    19    >   INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $16     
         23        SUB                                              ~17     $16, !2
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                                 
   13    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $19     
         29        ASSIGN                                                   !2, $19
   14    30        ASSIGN                                                   !3, 0
         31      > JMP                                                      ->42
   15    32    >   ASSIGN                                                   !5, 0
         33        COUNT                                            ~23     !0
         34        ASSIGN                                                   !6, ~23
         35      > JMP                                                      ->39
   16    36    >   FETCH_DIM_R                                      ~25     !0, !5
         37        ASSIGN                                                   !4, ~25
   15    38        PRE_INC                                                  !5
         39    >   IS_SMALLER                                               !5, !6
         40      > JMPNZ                                                    ~28, ->36
   14    41    >   PRE_INC                                                  !3
         42    >   IS_SMALLER                                               !3, !1
         43      > JMPNZ                                                    ~30, ->32
   19    44    >   INIT_FCALL                                               'var_dump'
         45        INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $31     
         48        SUB                                              ~32     $31, !2
         49        SEND_VAL                                                 ~32
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.62 ms | 1400 KiB | 19 Q