3v4l.org

run code in 300+ PHP versions simultaneously
<? $count = 1000000; function t($a) { return $a + 1; } function tl1(&$a) { $a += 1; } function tl2(&$a) { $a++; } class test { public static function staticTest($a) { return $a + 1; } public function nonStaticTest($a) { return $a + 1; } } $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a = $a + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a += 1; } echo '$a += 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a++; } echo '$a++: ', "\t\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { ++$a; } echo '++$a: ', "\t\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a = t($a); } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { tl1($a); } echo 'tl1($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { tl2($a); } echo 'tl2($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { test::staticTest($a); } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $test = new test; $i = 0; $a = 1; while ($i++ < $count) { $test->nonStaticTest($a); } echo '$test->nonStaticTest($a): ', "\t", (microtime(true) - $time), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 28
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 47
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 66
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 85
Branch analysis from position: 92
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
2 jumps found. (Code = 44) Position 1 = 113, Position 2 = 107
Branch analysis from position: 113
1 jumps found. (Code = 42) Position 1 = 131
Branch analysis from position: 131
2 jumps found. (Code = 44) Position 1 = 134, Position 2 = 128
Branch analysis from position: 134
1 jumps found. (Code = 42) Position 1 = 152
Branch analysis from position: 152
2 jumps found. (Code = 44) Position 1 = 155, Position 2 = 149
Branch analysis from position: 155
1 jumps found. (Code = 42) Position 1 = 176
Branch analysis from position: 176
2 jumps found. (Code = 44) Position 1 = 179, Position 2 = 173
Branch analysis from position: 179
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 173
2 jumps found. (Code = 44) Position 1 = 179, Position 2 = 173
Branch analysis from position: 179
Branch analysis from position: 173
Branch analysis from position: 149
2 jumps found. (Code = 44) Position 1 = 155, Position 2 = 149
Branch analysis from position: 155
Branch analysis from position: 149
Branch analysis from position: 128
2 jumps found. (Code = 44) Position 1 = 134, Position 2 = 128
Branch analysis from position: 134
Branch analysis from position: 128
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 113, Position 2 = 107
Branch analysis from position: 113
Branch analysis from position: 107
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 92, Position 2 = 85
Branch analysis from position: 92
Branch analysis from position: 85
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 66
Branch analysis from position: 70
Branch analysis from position: 66
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 47
Branch analysis from position: 51
Branch analysis from position: 47
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 28
Branch analysis from position: 32
Branch analysis from position: 28
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/6EruK
function name:  (null)
number of ops:  188
compiled vars:  !0 = $count, !1 = $time, !2 = $i, !3 = $a, !4 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1000000
   25     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   26     5        ASSIGN                                                   !2, 0
   27     6        ASSIGN                                                   !3, 1
   28     7      > JMP                                                      ->10
   29     8    >   ADD                                              ~10     !3, 1
          9        ASSIGN                                                   !3, ~10
   28    10    >   POST_INC                                         ~12     !2
         11        IS_SMALLER                                               ~12, !0
         12      > JMPNZ                                                    ~13, ->8
   31    13    >   ECHO                                                     '%24a+%3D+%24a+%2B+1%3A+'
         14        ECHO                                                     '%09%09%09'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $14     
         18        SUB                                              ~15     $14, !1
         19        ECHO                                                     ~15
         20        ECHO                                                     '%0A'
   33    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !1, $16
   34    25        ASSIGN                                                   !2, 0
   35    26        ASSIGN                                                   !3, 1
   36    27      > JMP                                                      ->29
   37    28    >   ASSIGN_OP                                     1          !3, 1
   36    29    >   POST_INC                                         ~21     !2
         30        IS_SMALLER                                               ~21, !0
         31      > JMPNZ                                                    ~22, ->28
   39    32    >   ECHO                                                     '%24a+%2B%3D+1%3A+'
         33        ECHO                                                     '%09%09%09'
         34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $23     
         37        SUB                                              ~24     $23, !1
         38        ECHO                                                     ~24
         39        ECHO                                                     '%0A'
   41    40        INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $25     
         43        ASSIGN                                                   !1, $25
   42    44        ASSIGN                                                   !2, 0
   43    45        ASSIGN                                                   !3, 1
   44    46      > JMP                                                      ->48
   45    47    >   PRE_INC                                                  !3
   44    48    >   POST_INC                                         ~30     !2
         49        IS_SMALLER                                               ~30, !0
         50      > JMPNZ                                                    ~31, ->47
   47    51    >   ECHO                                                     '%24a%2B%2B%3A+'
         52        ECHO                                                     '%09%09%09%09'
         53        INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $32     
         56        SUB                                              ~33     $32, !1
         57        ECHO                                                     ~33
         58        ECHO                                                     '%0A'
   49    59        INIT_FCALL                                               'microtime'
         60        SEND_VAL                                                 <true>
         61        DO_ICALL                                         $34     
         62        ASSIGN                                                   !1, $34
   50    63        ASSIGN                                                   !2, 0
   51    64        ASSIGN                                                   !3, 1
   52    65      > JMP                                                      ->67
   53    66    >   PRE_INC                                                  !3
   52    67    >   POST_INC                                         ~39     !2
         68        IS_SMALLER                                               ~39, !0
         69      > JMPNZ                                                    ~40, ->66
   55    70    >   ECHO                                                     '%2B%2B%24a%3A+'
         71        ECHO                                                     '%09%09%09%09'
         72        INIT_FCALL                                               'microtime'
         73        SEND_VAL                                                 <true>
         74        DO_ICALL                                         $41     
         75        SUB                                              ~42     $41, !1
         76        ECHO                                                     ~42
         77        ECHO                                                     '%0A'
   57    78        INIT_FCALL                                               'microtime'
         79        SEND_VAL                                                 <true>
         80        DO_ICALL                                         $43     
         81        ASSIGN                                                   !1, $43
   58    82        ASSIGN                                                   !2, 0
   59    83        ASSIGN                                                   !3, 1
   60    84      > JMP                                                      ->89
   61    85    >   INIT_FCALL                                               't'
         86        SEND_VAR                                                 !3
         87        DO_FCALL                                      0  $47     
         88        ASSIGN                                                   !3, $47
   60    89    >   POST_INC                                         ~49     !2
         90        IS_SMALLER                                               ~49, !0
         91      > JMPNZ                                                    ~50, ->85
   63    92    >   ECHO                                                     '%24a+%3D+t%28%24a%29%3A+'
         93        ECHO                                                     '%09%09%09'
         94        INIT_FCALL                                               'microtime'
         95        SEND_VAL                                                 <true>
         96        DO_ICALL                                         $51     
         97        SUB                                              ~52     $51, !1
         98        ECHO                                                     ~52
         99        ECHO                                                     '%0A'
   65   100        INIT_FCALL                                               'microtime'
        101        SEND_VAL                                                 <true>
        102        DO_ICALL                                         $53     
        103        ASSIGN                                                   !1, $53
   66   104        ASSIGN                                                   !2, 0
   67   105        ASSIGN                                                   !3, 1
   68   106      > JMP                                                      ->110
   69   107    >   INIT_FCALL                                               'tl1'
        108        SEND_REF                                                 !3
        109        DO_FCALL                                      0          
   68   110    >   POST_INC                                         ~58     !2
        111        IS_SMALLER                                               ~58, !0
        112      > JMPNZ                                                    ~59, ->107
   71   113    >   ECHO                                                     'tl1%28%24a%29%3A+'
        114        ECHO                                                     '%09%09%09'
        115        INIT_FCALL                                               'microtime'
        116        SEND_VAL                                                 <true>
        117        DO_ICALL                                         $60     
        118        SUB                                              ~61     $60, !1
        119        ECHO                                                     ~61
        120        ECHO                                                     '%0A'
   73   121        INIT_FCALL                                               'microtime'
        122        SEND_VAL                                                 <true>
        123        DO_ICALL                                         $62     
        124        ASSIGN                                                   !1, $62
   74   125        ASSIGN                                                   !2, 0
   75   126        ASSIGN                                                   !3, 1
   76   127      > JMP                                                      ->131
   77   128    >   INIT_FCALL                                               'tl2'
        129        SEND_REF                                                 !3
        130        DO_FCALL                                      0          
   76   131    >   POST_INC                                         ~67     !2
        132        IS_SMALLER                                               ~67, !0
        133      > JMPNZ                                                    ~68, ->128
   79   134    >   ECHO                                                     'tl2%28%24a%29%3A+'
        135        ECHO                                                     '%09%09%09'
        136        INIT_FCALL                                               'microtime'
        137        SEND_VAL                                                 <true>
        138        DO_ICALL                                         $69     
        139        SUB                                              ~70     $69, !1
        140        ECHO                                                     ~70
        141        ECHO                                                     '%0A'
   81   142        INIT_FCALL                                               'microtime'
        143        SEND_VAL                                                 <true>
        144        DO_ICALL                                         $71     
        145        ASSIGN                                                   !1, $71
   82   146        ASSIGN                                                   !2, 0
   83   147        ASSIGN                                                   !3, 1
   84   148      > JMP                                                      ->152
   85   149    >   INIT_STATIC_METHOD_CALL                                  'test', 'staticTest'
        150        SEND_VAR                                                 !3
        151        DO_FCALL                                      0          
   84   152    >   POST_INC                                         ~76     !2
        153        IS_SMALLER                                               ~76, !0
        154      > JMPNZ                                                    ~77, ->149
   87   155    >   ECHO                                                     'test%3A%3AstaticTest%28%24a%29%3A+'
        156        ECHO                                                     '%09%09'
        157        INIT_FCALL                                               'microtime'
        158        SEND_VAL                                                 <true>
        159        DO_ICALL                                         $78     
        160        SUB                                              ~79     $78, !1
        161        ECHO                                                     ~79
        162        ECHO                                                     '%0A'
   89   163        INIT_FCALL                                               'microtime'
        164        SEND_VAL                                                 <true>
        165        DO_ICALL                                         $80     
        166        ASSIGN                                                   !1, $80
   90   167        NEW                                              $82     'test'
        168        DO_FCALL                                      0          
        169        ASSIGN                                                   !4, $82
   91   170        ASSIGN                                                   !2, 0
   92   171        ASSIGN                                                   !3, 1
   93   172      > JMP                                                      ->176
   94   173    >   INIT_METHOD_CALL                                         !4, 'nonStaticTest'
        174        SEND_VAR_EX                                              !3
        175        DO_FCALL                                      0          
   93   176    >   POST_INC                                         ~88     !2
        177        IS_SMALLER                                               ~88, !0
        178      > JMPNZ                                                    ~89, ->173
   96   179    >   ECHO                                                     '%24test-%3EnonStaticTest%28%24a%29%3A+'
        180        ECHO                                                     '%09'
        181        INIT_FCALL                                               'microtime'
        182        SEND_VAL                                                 <true>
        183        DO_ICALL                                         $90     
        184        SUB                                              ~91     $90, !1
        185        ECHO                                                     ~91
        186        ECHO                                                     '%0A'
        187      > RETURN                                                   1

Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6EruK
function name:  t
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
    6     3*     > RETURN                                                   null

End of function t

Function tl1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6EruK
function name:  tl1
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OP                                     1          !0, 1
   10     2      > RETURN                                                   null

End of function tl1

Function tl2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6EruK
function name:  tl2
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        PRE_INC                                                  !0
   14     2      > RETURN                                                   null

End of function tl2

Class test:
Function statictest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6EruK
function name:  staticTest
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
   19     3*     > RETURN                                                   null

End of function statictest

Function nonstatictest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6EruK
function name:  nonStaticTest
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
   22     3*     > RETURN                                                   null

End of function nonstatictest

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.97 ms | 1419 KiB | 18 Q