3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tries = 100000; $arr = array(1,2,3); $start = microtime(true); $len = count($arr); for ($i = 0; $i < $tries; $i++) { for ($j = 0; $j < $len; $j++) { $test = $arr[$j]; } } echo (microtime(true) - $start)."\n"; $start = microtime(true); for ($i = 0; $i < $tries; $i++) { while ($item = next($arr) !== false) { } } echo (microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 10
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 32
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 33
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 32
Branch analysis from position: 42
Branch analysis from position: 32
Branch analysis from position: 33
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 12
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 10
Branch analysis from position: 20
Branch analysis from position: 10
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 12
Branch analysis from position: 17
Branch analysis from position: 12
filename:       /in/gX5fQ
function name:  (null)
number of ops:  48
compiled vars:  !0 = $tries, !1 = $arr, !2 = $start, !3 = $len, !4 = $i, !5 = $j, !6 = $test, !7 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 100000
    3     1        ASSIGN                                                   !1, <array>
    4     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !2, $10
    5     6        COUNT                                            ~12     !1
          7        ASSIGN                                                   !3, ~12
    7     8        ASSIGN                                                   !4, 0
          9      > JMP                                                      ->18
    8    10    >   ASSIGN                                                   !5, 0
         11      > JMP                                                      ->15
    9    12    >   FETCH_DIM_R                                      ~16     !1, !5
         13        ASSIGN                                                   !6, ~16
    8    14        PRE_INC                                                  !5
         15    >   IS_SMALLER                                               !5, !3
         16      > JMPNZ                                                    ~19, ->12
    7    17    >   PRE_INC                                                  !4
         18    >   IS_SMALLER                                               !4, !0
         19      > JMPNZ                                                    ~21, ->10
   12    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $22     
         23        SUB                                              ~23     $22, !2
         24        CONCAT                                           ~24     ~23, '%0A'
         25        ECHO                                                     ~24
   14    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $25     
         29        ASSIGN                                                   !2, $25
   15    30        ASSIGN                                                   !4, 0
         31      > JMP                                                      ->40
   16    32    > > JMP                                                      ->33
         33    >   INIT_FCALL                                               'next'
         34        SEND_REF                                                 !1
         35        DO_ICALL                                         $28     
         36        TYPE_CHECK                                  1018  ~29     $28
         37        ASSIGN                                           ~30     !7, ~29
         38      > JMPNZ                                                    ~30, ->33
   15    39    >   PRE_INC                                                  !4
         40    >   IS_SMALLER                                               !4, !0
         41      > JMPNZ                                                    ~32, ->32
   19    42    >   INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $33     
         45        SUB                                              ~34     $33, !2
         46        ECHO                                                     ~34
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.57 ms | 1400 KiB | 17 Q