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; $time_start = microtime(true); echo str_replace($var[0], $var[0].'-', $var) . "\n"; $time_end = microtime(true); echo "\nExecution Time: " . $time_end - $time_start;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Lk2k
function name:  (null)
number of ops:  43
compiled vars:  !0 = $var, !1 = $time_start, !2 = $time_end
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                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        FETCH_DIM_R                                      ~6      !0, 0
          6        CONCAT                                           ~7      ~6, '-'
          7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $8      
         11        CONCAT                                           ~9      ~7, $8
         12        CONCAT                                           ~10     ~9, '%0A'
         13        ECHO                                                     ~10
    6    14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !2, $11
    7    18        SUB                                              ~13     !2, !1
         19        CONCAT                                           ~14     '%0AExecution+Time%3A+', ~13
         20        ECHO                                                     ~14
    9    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !1, $15
   10    25        INIT_FCALL                                               'str_replace'
         26        FETCH_DIM_R                                      ~17     !0, 0
         27        SEND_VAL                                                 ~17
         28        FETCH_DIM_R                                      ~18     !0, 0
         29        CONCAT                                           ~19     ~18, '-'
         30        SEND_VAL                                                 ~19
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $20     
         33        CONCAT                                           ~21     $20, '%0A'
         34        ECHO                                                     ~21
   11    35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $22     
         38        ASSIGN                                                   !2, $22
   12    39        SUB                                              ~24     !2, !1
         40        CONCAT                                           ~25     '%0AExecution+Time%3A+', ~24
         41        ECHO                                                     ~25
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.8 ms | 1396 KiB | 19 Q