3v4l.org

run code in 300+ PHP versions simultaneously
<?php $c = 20000; function output1() { return 'h'.'e'.'l'.'l'.'o,'.' w'.'o'.'r'.'l'.'d'; } function output2() { echo 'h','e','l','l','o,',' w','o','r','l','d'; } $t = microtime(true); for ($i = 0; $i < $c; $i++) { $str = output1(); } var_dump(round(microtime(true) - $t, 6)); $t = microtime(true); for ($i = 0; $i < $c; $i++) { ob_start(); output2(); $str = ob_get_contents(); ob_end_clean(); } var_dump(round(microtime(true) - $t, 6)); $t = microtime(true); ob_start(); for ($i = 0; $i < $c; $i++) { output2(); } $str = ob_get_contents(); ob_end_clean(); var_dump(round(microtime(true) - $t, 6));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 30
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 61
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 61
Branch analysis from position: 66
Branch analysis from position: 61
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 30
Branch analysis from position: 42
Branch analysis from position: 30
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/K7c6e
function name:  (null)
number of ops:  83
compiled vars:  !0 = $c, !1 = $t, !2 = $i, !3 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 20000
   14     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   15     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->11
   16     7    >   INIT_FCALL                                               'output1'
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !3, $8
   15    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, !0
         12      > JMPNZ                                                    ~11, ->7
   18    13    >   INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'round'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $12     
         18        SUB                                              ~13     $12, !1
         19        SEND_VAL                                                 ~13
         20        SEND_VAL                                                 6
         21        DO_ICALL                                         $14     
         22        SEND_VAR                                                 $14
         23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $16     
         27        ASSIGN                                                   !1, $16
   21    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->40
   22    30    >   INIT_FCALL                                               'ob_start'
         31        DO_ICALL                                                 
   23    32        INIT_FCALL                                               'output2'
         33        DO_FCALL                                      0          
   24    34        INIT_FCALL                                               'ob_get_contents'
         35        DO_ICALL                                         $21     
         36        ASSIGN                                                   !3, $21
   25    37        INIT_FCALL                                               'ob_end_clean'
         38        DO_ICALL                                                 
   21    39        PRE_INC                                                  !2
         40    >   IS_SMALLER                                               !2, !0
         41      > JMPNZ                                                    ~25, ->30
   27    42    >   INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'round'
         44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $26     
         47        SUB                                              ~27     $26, !1
         48        SEND_VAL                                                 ~27
         49        SEND_VAL                                                 6
         50        DO_ICALL                                         $28     
         51        SEND_VAR                                                 $28
         52        DO_ICALL                                                 
   29    53        INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $30     
         56        ASSIGN                                                   !1, $30
   30    57        INIT_FCALL                                               'ob_start'
         58        DO_ICALL                                                 
   31    59        ASSIGN                                                   !2, 0
         60      > JMP                                                      ->64
   32    61    >   INIT_FCALL                                               'output2'
         62        DO_FCALL                                      0          
   31    63        PRE_INC                                                  !2
         64    >   IS_SMALLER                                               !2, !0
         65      > JMPNZ                                                    ~36, ->61
   34    66    >   INIT_FCALL                                               'ob_get_contents'
         67        DO_ICALL                                         $37     
         68        ASSIGN                                                   !3, $37
   35    69        INIT_FCALL                                               'ob_end_clean'
         70        DO_ICALL                                                 
   36    71        INIT_FCALL                                               'var_dump'
         72        INIT_FCALL                                               'round'
         73        INIT_FCALL                                               'microtime'
         74        SEND_VAL                                                 <true>
         75        DO_ICALL                                         $40     
         76        SUB                                              ~41     $40, !1
         77        SEND_VAL                                                 ~41
         78        SEND_VAL                                                 6
         79        DO_ICALL                                         $42     
         80        SEND_VAR                                                 $42
         81        DO_ICALL                                                 
         82      > RETURN                                                   1

Function output1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K7c6e
function name:  output1
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   'hello%2C+world'
    8     1*     > RETURN                                                   null

End of function output1

Function output2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K7c6e
function name:  output2
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'h'
          1        ECHO                                                     'e'
          2        ECHO                                                     'l'
          3        ECHO                                                     'l'
          4        ECHO                                                     'o%2C'
          5        ECHO                                                     '+w'
          6        ECHO                                                     'o'
          7        ECHO                                                     'r'
          8        ECHO                                                     'l'
          9        ECHO                                                     'd'
   12    10      > RETURN                                                   null

End of function output2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.63 ms | 1407 KiB | 28 Q