3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array_fill(0, 1000, 'xxxxx'); $arr2 = array_fill(0, 1000, 'xxxxx'); $runs = 100; $first = 0.0; $second = 0.0; for ($i = 0; $i < $runs; $i++) { $start = microtime(true); foreach ($arr as $value) { strpos('xxxxxxx', $value); } $end = microtime(true); $first += ($end-$start); $start = microtime(true); foreach ($arr2 as &$value2) { strpos('xxxxxxx', $value2); } $end = microtime(true); $second += ($end-$start); } print "First: " . ($first/$runs) . PHP_EOL; print "Second: " . ($second/$runs) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 17
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 28
2 jumps found. (Code = 125) Position 1 = 40, Position 2 = 46
Branch analysis from position: 40
2 jumps found. (Code = 126) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 17
Branch analysis from position: 56
Branch analysis from position: 17
Branch analysis from position: 46
Branch analysis from position: 28
filename:       /in/i6EvY
function name:  (null)
number of ops:  65
compiled vars:  !0 = $arr, !1 = $arr2, !2 = $runs, !3 = $first, !4 = $second, !5 = $i, !6 = $start, !7 = $value, !8 = $end, !9 = $value2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1000
          3        SEND_VAL                                                 'xxxxx'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !0, $10
    4     6        INIT_FCALL                                               'array_fill'
          7        SEND_VAL                                                 0
          8        SEND_VAL                                                 1000
          9        SEND_VAL                                                 'xxxxx'
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !1, $12
    6    12        ASSIGN                                                   !2, 100
    8    13        ASSIGN                                                   !3, 0
    9    14        ASSIGN                                                   !4, 0
   10    15        ASSIGN                                                   !5, 0
         16      > JMP                                                      ->54
   12    17    >   INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $18     
         20        ASSIGN                                                   !6, $18
   13    21      > FE_RESET_R                                       $20     !0, ->28
         22    > > FE_FETCH_R                                               $20, !7, ->28
   14    23    >   INIT_FCALL                                               'strpos'
         24        SEND_VAL                                                 'xxxxxxx'
         25        SEND_VAR                                                 !7
         26        DO_ICALL                                                 
   13    27      > JMP                                                      ->22
         28    >   FE_FREE                                                  $20
   16    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !8, $22
   17    33        SUB                                              ~24     !8, !6
         34        ASSIGN_OP                                     1          !3, ~24
   19    35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $26     
         38        ASSIGN                                                   !6, $26
   20    39      > FE_RESET_RW                                      $28     !1, ->46
         40    > > FE_FETCH_RW                                              $28, !9, ->46
   21    41    >   INIT_FCALL                                               'strpos'
         42        SEND_VAL                                                 'xxxxxxx'
         43        SEND_VAR                                                 !9
         44        DO_ICALL                                                 
   20    45      > JMP                                                      ->40
         46    >   FE_FREE                                                  $28
   23    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $30     
         50        ASSIGN                                                   !8, $30
   24    51        SUB                                              ~32     !8, !6
         52        ASSIGN_OP                                     1          !4, ~32
   10    53        PRE_INC                                                  !5
         54    >   IS_SMALLER                                               !5, !2
         55      > JMPNZ                                                    ~35, ->17
   27    56    >   DIV                                              ~36     !3, !2
         57        CONCAT                                           ~37     'First%3A++', ~36
         58        CONCAT                                           ~38     ~37, '%0A'
         59        ECHO                                                     ~38
   28    60        DIV                                              ~39     !4, !2
         61        CONCAT                                           ~40     'Second%3A+', ~39
         62        CONCAT                                           ~41     ~40, '%0A'
         63        ECHO                                                     ~41
         64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.01 ms | 1400 KiB | 19 Q