3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iterations = 500000; $name = 'Tom'; $date = '13/09/2009'; $t1 = microtime(true); for ($i = 0; $i < $iterations; $i++) { $str = 'Hi ' . $name . ', you last logged in on ' . $date; } $t2 = microtime(true); echo 'concat: ' . ($t2-$t1); echo '<br />'; $t1 = microtime(true); for ($i = 0; $i < $iterations; $i++) { $str = sprintf('Hi %s, you last logged in on %s.', $name, $date); } $t2 = microtime(true); echo 'sprintf: ' . ($t2-$t1); echo '<br />';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 9
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 30
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 30
Branch analysis from position: 39
Branch analysis from position: 30
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 9
Branch analysis from position: 16
Branch analysis from position: 9
filename:       /in/dAD0F
function name:  (null)
number of ops:  48
compiled vars:  !0 = $iterations, !1 = $name, !2 = $date, !3 = $t1, !4 = $i, !5 = $str, !6 = $t2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 500000
    4     1        ASSIGN                                                   !1, 'Tom'
    5     2        ASSIGN                                                   !2, '13%2F09%2F2009'
   10     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $10     
          6        ASSIGN                                                   !3, $10
   11     7        ASSIGN                                                   !4, 0
          8      > JMP                                                      ->14
   12     9    >   CONCAT                                           ~13     'Hi+', !1
         10        CONCAT                                           ~14     ~13, '%2C+you+last+logged+in+on+'
         11        CONCAT                                           ~15     ~14, !2
         12        ASSIGN                                                   !5, ~15
   11    13        PRE_INC                                                  !4
         14    >   IS_SMALLER                                               !4, !0
         15      > JMPNZ                                                    ~18, ->9
   14    16    >   INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $19     
         19        ASSIGN                                                   !6, $19
   15    20        SUB                                              ~21     !6, !3
         21        CONCAT                                           ~22     'concat%3A+', ~21
         22        ECHO                                                     ~22
   17    23        ECHO                                                     '%3Cbr+%2F%3E'
   21    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $23     
         27        ASSIGN                                                   !3, $23
   22    28        ASSIGN                                                   !4, 0
         29      > JMP                                                      ->37
   23    30    >   INIT_FCALL                                               'sprintf'
         31        SEND_VAL                                                 'Hi+%25s%2C+you+last+logged+in+on+%25s.'
         32        SEND_VAR                                                 !1
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                         $26     
         35        ASSIGN                                                   !5, $26
   22    36        PRE_INC                                                  !4
         37    >   IS_SMALLER                                               !4, !0
         38      > JMPNZ                                                    ~29, ->30
   25    39    >   INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $30     
         42        ASSIGN                                                   !6, $30
   26    43        SUB                                              ~32     !6, !3
         44        CONCAT                                           ~33     'sprintf%3A+', ~32
         45        ECHO                                                     ~33
   28    46        ECHO                                                     '%3Cbr+%2F%3E'
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.97 ms | 1400 KiB | 17 Q