3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mt($start=null){ if ($start === null) return microtime(true); return number_format(microtime(true)-$start, 4); } $str_100k = str_repeat('a', 102400).str_repeat('b', 1024); $str = $str_100k; $needle = 'bbbbbbbbb'; $start = mt(); for ($i=0; $i<500; $i++) $j = strpos($str, $needle); // strpos $t_strpos = mt($start); #echo "\t".mt($start); $start = mt(); for ($i=0; $i<500; $i++) $j = stripos($str, $needle); // stripos $t_stripos = mt($start); #echo "\t".mt($start); echo number_format($t_stripos/$t_strpos, 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 17
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 34
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 34
Branch analysis from position: 42
Branch analysis from position: 34
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 17
Branch analysis from position: 25
Branch analysis from position: 17
filename:       /in/3r6cZ
function name:  (null)
number of ops:  53
compiled vars:  !0 = $str_100k, !1 = $str, !2 = $needle, !3 = $start, !4 = $i, !5 = $j, !6 = $t_strpos, !7 = $t_stripos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'str_repeat'
          1        SEND_VAL                                                 'a'
          2        SEND_VAL                                                 102400
          3        DO_ICALL                                         $8      
          4        INIT_FCALL                                               'str_repeat'
          5        SEND_VAL                                                 'b'
          6        SEND_VAL                                                 1024
          7        DO_ICALL                                         $9      
          8        CONCAT                                           ~10     $8, $9
          9        ASSIGN                                                   !0, ~10
    9    10        ASSIGN                                                   !1, !0
   11    11        ASSIGN                                                   !2, 'bbbbbbbbb'
   13    12        INIT_FCALL                                               'mt'
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !3, $14
   14    15        ASSIGN                                                   !4, 0
         16      > JMP                                                      ->23
         17    >   INIT_FCALL                                               'strpos'
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $17     
         21        ASSIGN                                                   !5, $17
         22        PRE_INC                                                  !4
         23    >   IS_SMALLER                                               !4, 500
         24      > JMPNZ                                                    ~20, ->17
   15    25    >   INIT_FCALL                                               'mt'
         26        SEND_VAR                                                 !3
         27        DO_FCALL                                      0  $21     
         28        ASSIGN                                                   !6, $21
   18    29        INIT_FCALL                                               'mt'
         30        DO_FCALL                                      0  $23     
         31        ASSIGN                                                   !3, $23
   19    32        ASSIGN                                                   !4, 0
         33      > JMP                                                      ->40
         34    >   INIT_FCALL                                               'stripos'
         35        SEND_VAR                                                 !1
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $26     
         38        ASSIGN                                                   !5, $26
         39        PRE_INC                                                  !4
         40    >   IS_SMALLER                                               !4, 500
         41      > JMPNZ                                                    ~29, ->34
   20    42    >   INIT_FCALL                                               'mt'
         43        SEND_VAR                                                 !3
         44        DO_FCALL                                      0  $30     
         45        ASSIGN                                                   !7, $30
   23    46        INIT_FCALL                                               'number_format'
         47        DIV                                              ~32     !7, !6
         48        SEND_VAL                                                 ~32
         49        SEND_VAL                                                 1
         50        DO_ICALL                                         $33     
         51        ECHO                                                     $33
         52      > RETURN                                                   1

Function mt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3r6cZ
function name:  mt
number of ops:  17
compiled vars:  !0 = $start
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      null
    4     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
          3    >   INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
    5     7    >   INIT_FCALL                                               'number_format'
          8        INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $3      
         11        SUB                                              ~4      $3, !0
         12        SEND_VAL                                                 ~4
         13        SEND_VAL                                                 4
         14        DO_ICALL                                         $5      
         15      > RETURN                                                   $5
    6    16*     > RETURN                                                   null

End of function mt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.24 ms | 1403 KiB | 27 Q