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 $s2 - $s1; $s3 = microtime(true); $i = $b; while($i--) { $a = reset($array); } $s4 = microtime(true); echo "\n"; echo $s4 - $s3;
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 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 38
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 38
Branch analysis from position: 44
Branch analysis from position: 38
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/VXAhW
function name:  (null)
number of ops:  52
compiled vars:  !0 = $b, !1 = $array, !2 = $i, !3 = $s1, !4 = $a, !5 = $s2, !6 = $s3, !7 = $s4
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                                         $10     
          8        ASSIGN                                                   !1, $10
    8     9        ASSIGN                                                   !2, !0
    9    10        INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $13     
         13        ASSIGN                                                   !3, $13
   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                                         $15     
         21        SEND_VAR_NO_REF                               0          $15
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !4, $16
   11    24    >   POST_DEC                                         ~18     !2
         25      > JMPNZ                                                    ~18, ->15
   15    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $19     
         29        ASSIGN                                                   !5, $19
   16    30        SUB                                              ~21     !5, !3
         31        ECHO                                                     ~21
   18    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $22     
         35        ASSIGN                                                   !6, $22
   19    36        ASSIGN                                                   !2, !0
   20    37      > JMP                                                      ->42
   22    38    >   INIT_FCALL                                               'reset'
         39        SEND_REF                                                 !1
         40        DO_ICALL                                         $25     
         41        ASSIGN                                                   !4, $25
   20    42    >   POST_DEC                                         ~27     !2
         43      > JMPNZ                                                    ~27, ->38
   24    44    >   INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $28     
         47        ASSIGN                                                   !7, $28
   25    48        ECHO                                                     '%0A'
   26    49        SUB                                              ~30     !7, !6
         50        ECHO                                                     ~30
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.18 ms | 1400 KiB | 25 Q