3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string1 = 'aaaaaaaaaaaaaaaaaaaa'; $string2 = 'bbbbbbbbbbbbbbbbbbbb'; $string3 = 'cccccccccccccccccccc'; $string4 = 'dddddddddddddddddddd'; $string5 = 'eeeeeeeeeeeeeeeeeeee'; $results = array(); $time1 = microtime(true); for ($i = 0; $i<1000000; $i++) { $concatTest1 = $string1 . $string2 . $string3 . $string4 . $string5; } unset($i); $time2 = microtime(true); $testDuration1 = $time2 - $time1; $results['Test1'] = $testDuration1; $time3 = microtime(true); for ($i = 0; $i<1000000; $i++) { $concatTest2 = "{$string1}{$string2}{$string3}{$string4}{$string5}"; } unset($i); $time4 = microtime(true); $testDuration2 = $time4 - $time3; $results['Test2'] = $testDuration2; $time5 = microtime(true); for ($i = 0; $i<1000000; $i++) { $concatTest3 = implode('', array( $string1, $string2, $string3, $string4, $string5 )); } unset($i); $time6 = microtime(true); $testDuration3 = $time6 - $time5; $results['Test3'] = $testDuration3; $time7 = microtime(true); for ($i = 0; $i<1000000; $i++) { $concatTest4 = sprintf('%s%s%s%s%s', array( $string1, $string2, $string3, $string4, $string5 )); } unset($i); $time8 = microtime(true); $testDuration4 = $time8 - $time7; $results['Test4'] = $testDuration4; $finalResults = sort($results); var_dump($finalResults);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 35
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 59
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
2 jumps found. (Code = 44) Position 1 = 100, Position 2 = 87
Branch analysis from position: 100
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
2 jumps found. (Code = 44) Position 1 = 100, Position 2 = 87
Branch analysis from position: 100
Branch analysis from position: 87
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 59
Branch analysis from position: 72
Branch analysis from position: 59
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 35
Branch analysis from position: 44
Branch analysis from position: 35
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
Branch analysis from position: 12
filename:       /in/7YHej
function name:  (null)
number of ops:  117
compiled vars:  !0 = $string1, !1 = $string2, !2 = $string3, !3 = $string4, !4 = $string5, !5 = $results, !6 = $time1, !7 = $i, !8 = $concatTest1, !9 = $time2, !10 = $testDuration1, !11 = $time3, !12 = $concatTest2, !13 = $time4, !14 = $testDuration2, !15 = $time5, !16 = $concatTest3, !17 = $time6, !18 = $testDuration3, !19 = $time7, !20 = $concatTest4, !21 = $time8, !22 = $testDuration4, !23 = $finalResults
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aaaaaaaaaaaaaaaaaaaa'
    4     1        ASSIGN                                                   !1, 'bbbbbbbbbbbbbbbbbbbb'
    5     2        ASSIGN                                                   !2, 'cccccccccccccccccccc'
    6     3        ASSIGN                                                   !3, 'dddddddddddddddddddd'
    7     4        ASSIGN                                                   !4, 'eeeeeeeeeeeeeeeeeeee'
   10     5        ASSIGN                                                   !5, <array>
   12     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $30     
          9        ASSIGN                                                   !6, $30
   13    10        ASSIGN                                                   !7, 0
         11      > JMP                                                      ->18
   14    12    >   CONCAT                                           ~33     !0, !1
         13        CONCAT                                           ~34     ~33, !2
         14        CONCAT                                           ~35     ~34, !3
         15        CONCAT                                           ~36     ~35, !4
         16        ASSIGN                                                   !8, ~36
   13    17        PRE_INC                                                  !7
         18    >   IS_SMALLER                                               !7, 1000000
         19      > JMPNZ                                                    ~39, ->12
   16    20    >   UNSET_CV                                                 !7
   17    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $40     
         24        ASSIGN                                                   !9, $40
   18    25        SUB                                              ~42     !9, !6
         26        ASSIGN                                                   !10, ~42
   19    27        ASSIGN_DIM                                               !5, 'Test1'
         28        OP_DATA                                                  !10
   21    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $45     
         32        ASSIGN                                                   !11, $45
   22    33        ASSIGN                                                   !7, 0
         34      > JMP                                                      ->42
   23    35    >   ROPE_INIT                                     5  ~49     !0
         36        ROPE_ADD                                      1  ~49     ~49, !1
         37        ROPE_ADD                                      2  ~49     ~49, !2
         38        ROPE_ADD                                      3  ~49     ~49, !3
         39        ROPE_END                                      4  ~48     ~49, !4
         40        ASSIGN                                                   !12, ~48
   22    41        PRE_INC                                                  !7
         42    >   IS_SMALLER                                               !7, 1000000
         43      > JMPNZ                                                    ~54, ->35
   25    44    >   UNSET_CV                                                 !7
   26    45        INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $55     
         48        ASSIGN                                                   !13, $55
   27    49        SUB                                              ~57     !13, !11
         50        ASSIGN                                                   !14, ~57
   28    51        ASSIGN_DIM                                               !5, 'Test2'
         52        OP_DATA                                                  !14
   31    53        INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $60     
         56        ASSIGN                                                   !15, $60
   32    57        ASSIGN                                                   !7, 0
         58      > JMP                                                      ->70
   33    59    >   INIT_FCALL                                               'implode'
         60        SEND_VAL                                                 ''
   34    61        INIT_ARRAY                                       ~63     !0
         62        ADD_ARRAY_ELEMENT                                ~63     !1
         63        ADD_ARRAY_ELEMENT                                ~63     !2
         64        ADD_ARRAY_ELEMENT                                ~63     !3
         65        ADD_ARRAY_ELEMENT                                ~63     !4
         66        SEND_VAL                                                 ~63
         67        DO_ICALL                                         $64     
   33    68        ASSIGN                                                   !16, $64
   32    69        PRE_INC                                                  !7
         70    >   IS_SMALLER                                               !7, 1000000
         71      > JMPNZ                                                    ~67, ->59
   37    72    >   UNSET_CV                                                 !7
   38    73        INIT_FCALL                                               'microtime'
         74        SEND_VAL                                                 <true>
         75        DO_ICALL                                         $68     
         76        ASSIGN                                                   !17, $68
   39    77        SUB                                              ~70     !17, !15
         78        ASSIGN                                                   !18, ~70
   40    79        ASSIGN_DIM                                               !5, 'Test3'
         80        OP_DATA                                                  !18
   42    81        INIT_FCALL                                               'microtime'
         82        SEND_VAL                                                 <true>
         83        DO_ICALL                                         $73     
         84        ASSIGN                                                   !19, $73
   43    85        ASSIGN                                                   !7, 0
         86      > JMP                                                      ->98
   44    87    >   INIT_FCALL                                               'sprintf'
         88        SEND_VAL                                                 '%25s%25s%25s%25s%25s'
   45    89        INIT_ARRAY                                       ~76     !0
         90        ADD_ARRAY_ELEMENT                                ~76     !1
         91        ADD_ARRAY_ELEMENT                                ~76     !2
         92        ADD_ARRAY_ELEMENT                                ~76     !3
         93        ADD_ARRAY_ELEMENT                                ~76     !4
         94        SEND_VAL                                                 ~76
         95        DO_ICALL                                         $77     
   44    96        ASSIGN                                                   !20, $77
   43    97        PRE_INC                                                  !7
         98    >   IS_SMALLER                                               !7, 1000000
         99      > JMPNZ                                                    ~80, ->87
   48   100    >   UNSET_CV                                                 !7
   49   101        INIT_FCALL                                               'microtime'
        102        SEND_VAL                                                 <true>
        103        DO_ICALL                                         $81     
        104        ASSIGN                                                   !21, $81
   50   105        SUB                                              ~83     !21, !19
        106        ASSIGN                                                   !22, ~83
   51   107        ASSIGN_DIM                                               !5, 'Test4'
        108        OP_DATA                                                  !22
   53   109        INIT_FCALL                                               'sort'
        110        SEND_REF                                                 !5
        111        DO_ICALL                                         $86     
        112        ASSIGN                                                   !23, $86
   55   113        INIT_FCALL                                               'var_dump'
        114        SEND_VAR                                                 !23
        115        DO_ICALL                                                 
        116      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.57 ms | 1404 KiB | 23 Q