3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time_start = microtime(true); $myArray = array(); for ( $i = 0; $i < 100000; ++$i ){ $myArray[] = $i; $myArray[] = 'test a string';} $time_end = microtime(true); printf("Took %f seconds for array[]\n", $time_end - $time_start); $time_start = microtime(true); $myArray = array(); for ( $i = 0; $i < 100000; ++$i ){ array_push($myArray, $i); array_push($myArray, 'test a string');} $time_end = microtime(true); printf("Took %f seconds for array_push\n", $time_end - $time_start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 30
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 30
Branch analysis from position: 41
Branch analysis from position: 30
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/nfGCE
function name:  (null)
number of ops:  51
compiled vars:  !0 = $time_start, !1 = $myArray, !2 = $i, !3 = $time_end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
    3     4        ASSIGN                                                   !1, <array>
    4     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->12
    5     7    >   ASSIGN_DIM                                               !1
          8        OP_DATA                                                  !2
    6     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  'test+a+string'
    4    11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 100000
         13      > JMPNZ                                                    ~11, ->7
    7    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !3, $12
    8    18        INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 'Took+%25f+seconds+for+array%5B%5D%0A'
         20        SUB                                              ~14     !3, !0
         21        SEND_VAL                                                 ~14
         22        DO_ICALL                                                 
   10    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !0, $16
   11    27        ASSIGN                                                   !1, <array>
   12    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->39
   13    30    >   INIT_FCALL                                               'array_push'
         31        SEND_REF                                                 !1
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                                 
   14    34        INIT_FCALL                                               'array_push'
         35        SEND_REF                                                 !1
         36        SEND_VAL                                                 'test+a+string'
         37        DO_ICALL                                                 
   12    38        PRE_INC                                                  !2
         39    >   IS_SMALLER                                               !2, 100000
         40      > JMPNZ                                                    ~23, ->30
   15    41    >   INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $24     
         44        ASSIGN                                                   !3, $24
   16    45        INIT_FCALL                                               'printf'
         46        SEND_VAL                                                 'Took+%25f+seconds+for+array_push%0A'
         47        SUB                                              ~26     !3, !0
         48        SEND_VAL                                                 ~26
         49        DO_ICALL                                                 
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.33 ms | 1405 KiB | 19 Q