3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '-1'); $ary1 = array(); $ary2 = array(); $timeBegin = time(); for ($i = 0; $i <= 1000000; $i++) { $ary1[] = $i; } $timeEnd1 = time(); for ($i = 0; $i <= 1000000; $i++) { array_push($ary2, $i); } $timeEnd2 = time(); var_dump($timeBegin, $timeEnd1, $timeEnd2); echo 'first loop take ' . ($timeEnd1 - $timeBegin) . ' seconds' . PHP_EOL; echo 'second loop take ' . ($timeEnd2 - $timeEnd1) . ' seconds' . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 11
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 21
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 21
Branch analysis from position: 28
Branch analysis from position: 21
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 11
Branch analysis from position: 16
Branch analysis from position: 11
filename:       /in/JBk3l
function name:  (null)
number of ops:  47
compiled vars:  !0 = $ary1, !1 = $ary2, !2 = $timeBegin, !3 = $i, !4 = $timeEnd1, !5 = $timeEnd2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'memory_limit'
          2        SEND_VAL                                                 '-1'
          3        DO_ICALL                                                 
    3     4        ASSIGN                                                   !0, <array>
    4     5        ASSIGN                                                   !1, <array>
    5     6        INIT_FCALL                                               'time'
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !2, $9
    6     9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->14
    7    11    >   ASSIGN_DIM                                               !0
         12        OP_DATA                                                  !3
    6    13        PRE_INC                                                  !3
         14    >   IS_SMALLER_OR_EQUAL                                      !3, 1000000
         15      > JMPNZ                                                    ~14, ->11
    9    16    >   INIT_FCALL                                               'time'
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !4, $15
   10    19        ASSIGN                                                   !3, 0
         20      > JMP                                                      ->26
   11    21    >   INIT_FCALL                                               'array_push'
         22        SEND_REF                                                 !1
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
   10    25        PRE_INC                                                  !3
         26    >   IS_SMALLER_OR_EQUAL                                      !3, 1000000
         27      > JMPNZ                                                    ~20, ->21
   13    28    >   INIT_FCALL                                               'time'
         29        DO_ICALL                                         $21     
         30        ASSIGN                                                   !5, $21
   14    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !2
         33        SEND_VAR                                                 !4
         34        SEND_VAR                                                 !5
         35        DO_ICALL                                                 
   15    36        SUB                                              ~24     !4, !2
         37        CONCAT                                           ~25     'first+loop+take+', ~24
         38        CONCAT                                           ~26     ~25, '+seconds'
         39        CONCAT                                           ~27     ~26, '%0A'
         40        ECHO                                                     ~27
   16    41        SUB                                              ~28     !5, !4
         42        CONCAT                                           ~29     'second+loop+take+', ~28
         43        CONCAT                                           ~30     ~29, '+seconds'
         44        CONCAT                                           ~31     ~30, '%0A'
         45        ECHO                                                     ~31
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.45 ms | 1400 KiB | 21 Q