3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.46 ms | 1400 KiB | 19 Q