3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $b = 1000; $array = range(1000, 1); $i = $b; $s1 = microtime(true); while($i--) { $a = array_shift(array_slice($array, 0, 1)); } $s2 = microtime(true); echo $a1 = $s2 - $s1; $s3 = microtime(true); $i = $b; while($i--) { $a = reset($array); } $s4 = microtime(true); echo "\n"; echo $a2 = $s4 - $s3; echo "\n"; echo $a2/$a1;
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 = 15
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 = 39
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 39
Branch analysis from position: 45
Branch analysis from position: 39
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 15
Branch analysis from position: 26
Branch analysis from position: 15
filename:       /in/72RV3
function name:  (null)
number of ops:  57
compiled vars:  !0 = $b, !1 = $array, !2 = $i, !3 = $s1, !4 = $a, !5 = $s2, !6 = $a1, !7 = $s3, !8 = $s4, !9 = $a2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, 1000
    6     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 1000
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $12     
          8        ASSIGN                                                   !1, $12
    8     9        ASSIGN                                                   !2, !0
    9    10        INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $15     
         13        ASSIGN                                                   !3, $15
   11    14      > JMP                                                      ->24
   13    15    >   INIT_FCALL                                               'array_shift'
         16        INIT_FCALL                                               'array_slice'
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 0
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $17     
         21        SEND_VAR_NO_REF                               0          $17
         22        DO_ICALL                                         $18     
         23        ASSIGN                                                   !4, $18
   11    24    >   POST_DEC                                         ~20     !2
         25      > JMPNZ                                                    ~20, ->15
   15    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !5, $21
   16    30        SUB                                              ~23     !5, !3
         31        ASSIGN                                           ~24     !6, ~23
         32        ECHO                                                     ~24
   18    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $25     
         36        ASSIGN                                                   !7, $25
   19    37        ASSIGN                                                   !2, !0
   20    38      > JMP                                                      ->43
   22    39    >   INIT_FCALL                                               'reset'
         40        SEND_REF                                                 !1
         41        DO_ICALL                                         $28     
         42        ASSIGN                                                   !4, $28
   20    43    >   POST_DEC                                         ~30     !2
         44      > JMPNZ                                                    ~30, ->39
   24    45    >   INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $31     
         48        ASSIGN                                                   !8, $31
   25    49        ECHO                                                     '%0A'
   26    50        SUB                                              ~33     !8, !7
         51        ASSIGN                                           ~34     !9, ~33
         52        ECHO                                                     ~34
   27    53        ECHO                                                     '%0A'
   28    54        DIV                                              ~35     !9, !6
         55        ECHO                                                     ~35
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.11 ms | 1400 KiB | 25 Q