3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = "12345"; $time_start = microtime(true); echo $var[0] . "-" . substr($var,1) . "\n"; $time_end = microtime(true); echo "\nExecution Time: " . $time_end - $time_start . "\n"; $time_start2 = microtime(true); echo str_replace($var[0], $var[0].'-', $var) . "\n"; $time_end2 = microtime(true); echo "\nExecution Time: " . $time_end2 - $time_start2; $time_start3 = microtime(true); echo substr_replace($var, '-', 1, 0); $time_end3 = microtime(true); echo "\nExecution Time: " . $time_end3 - $time_start3;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Us4BE
function name:  (null)
number of ops:  62
compiled vars:  !0 = $var, !1 = $time_start, !2 = $time_end, !3 = $time_start2, !4 = $time_end2, !5 = $time_start3, !6 = $time_end3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '12345'
    4     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !1, $8
    5     5        FETCH_DIM_R                                      ~10     !0, 0
          6        CONCAT                                           ~11     ~10, '-'
          7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $12     
         11        CONCAT                                           ~13     ~11, $12
         12        CONCAT                                           ~14     ~13, '%0A'
         13        ECHO                                                     ~14
    6    14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $15     
         17        ASSIGN                                                   !2, $15
    7    18        SUB                                              ~17     !2, !1
         19        CONCAT                                           ~18     '%0AExecution+Time%3A+', ~17
         20        CONCAT                                           ~19     ~18, '%0A'
         21        ECHO                                                     ~19
    9    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $20     
         25        ASSIGN                                                   !3, $20
   10    26        INIT_FCALL                                               'str_replace'
         27        FETCH_DIM_R                                      ~22     !0, 0
         28        SEND_VAL                                                 ~22
         29        FETCH_DIM_R                                      ~23     !0, 0
         30        CONCAT                                           ~24     ~23, '-'
         31        SEND_VAL                                                 ~24
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $25     
         34        CONCAT                                           ~26     $25, '%0A'
         35        ECHO                                                     ~26
   11    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $27     
         39        ASSIGN                                                   !4, $27
   12    40        SUB                                              ~29     !4, !3
         41        CONCAT                                           ~30     '%0AExecution+Time%3A+', ~29
         42        ECHO                                                     ~30
   14    43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $31     
         46        ASSIGN                                                   !5, $31
   15    47        INIT_FCALL                                               'substr_replace'
         48        SEND_VAR                                                 !0
         49        SEND_VAL                                                 '-'
         50        SEND_VAL                                                 1
         51        SEND_VAL                                                 0
         52        DO_ICALL                                         $33     
         53        ECHO                                                     $33
   16    54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $34     
         57        ASSIGN                                                   !6, $34
   17    58        SUB                                              ~36     !6, !5
         59        CONCAT                                           ~37     '%0AExecution+Time%3A+', ~36
         60        ECHO                                                     ~37
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.55 ms | 1400 KiB | 21 Q