3v4l.org

run code in 300+ PHP versions simultaneously
<? $count = 1000000; function t($a, $b) { return ($a + $b) * ($a - $b); } class test { public static function staticTest($a, $b) { return ($a + $b) * ($a - $b); } } $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $res = ($a + $b) * ($a - $b); $a = $a + 2; $b = $b + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $a = t($a, $b); $a = $a + 2; $b = $b + 1; } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { test::staticTest($a, $b); $a = $a + 2; $b = $b + 1; } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 9
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 36
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 64
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 64
Branch analysis from position: 75
Branch analysis from position: 64
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 36
Branch analysis from position: 48
Branch analysis from position: 36
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 9
Branch analysis from position: 20
Branch analysis from position: 9
filename:       /in/DsANG
function name:  (null)
number of ops:  84
compiled vars:  !0 = $count, !1 = $time, !2 = $i, !3 = $a, !4 = $b, !5 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1000000
   14     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   15     5        ASSIGN                                                   !2, 0
   16     6        ASSIGN                                                   !3, 1
   17     7        ASSIGN                                                   !4, 1
   18     8      > JMP                                                      ->17
   19     9    >   ADD                                              ~12     !3, !4
         10        SUB                                              ~13     !3, !4
         11        MUL                                              ~14     ~12, ~13
         12        ASSIGN                                                   !5, ~14
   20    13        ADD                                              ~16     !3, 2
         14        ASSIGN                                                   !3, ~16
   21    15        ADD                                              ~18     !4, 1
         16        ASSIGN                                                   !4, ~18
   18    17    >   POST_INC                                         ~20     !2
         18        IS_SMALLER                                               ~20, !0
         19      > JMPNZ                                                    ~21, ->9
   23    20    >   ECHO                                                     '%24a+%3D+%24a+%2B+1%3A+'
         21        ECHO                                                     '%09%09%09'
         22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $22     
         25        SUB                                              ~23     $22, !1
         26        ECHO                                                     ~23
         27        ECHO                                                     '%0A'
   25    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $24     
         31        ASSIGN                                                   !1, $24
   26    32        ASSIGN                                                   !2, 0
   27    33        ASSIGN                                                   !3, 1
   28    34        ASSIGN                                                   !4, 1
   29    35      > JMP                                                      ->45
   30    36    >   INIT_FCALL                                               't'
         37        SEND_VAR                                                 !3
         38        SEND_VAR                                                 !4
         39        DO_FCALL                                      0  $29     
         40        ASSIGN                                                   !3, $29
   31    41        ADD                                              ~31     !3, 2
         42        ASSIGN                                                   !3, ~31
   32    43        ADD                                              ~33     !4, 1
         44        ASSIGN                                                   !4, ~33
   29    45    >   POST_INC                                         ~35     !2
         46        IS_SMALLER                                               ~35, !0
         47      > JMPNZ                                                    ~36, ->36
   34    48    >   ECHO                                                     '%24a+%3D+t%28%24a%29%3A+'
         49        ECHO                                                     '%09%09%09'
         50        INIT_FCALL                                               'microtime'
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $37     
         53        SUB                                              ~38     $37, !1
         54        ECHO                                                     ~38
         55        ECHO                                                     '%0A'
   36    56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $39     
         59        ASSIGN                                                   !1, $39
   37    60        ASSIGN                                                   !2, 0
   38    61        ASSIGN                                                   !3, 1
   39    62        ASSIGN                                                   !4, 1
   40    63      > JMP                                                      ->72
   41    64    >   INIT_STATIC_METHOD_CALL                                  'test', 'staticTest'
         65        SEND_VAR                                                 !3
         66        SEND_VAR                                                 !4
         67        DO_FCALL                                      0          
   42    68        ADD                                              ~45     !3, 2
         69        ASSIGN                                                   !3, ~45
   43    70        ADD                                              ~47     !4, 1
         71        ASSIGN                                                   !4, ~47
   40    72    >   POST_INC                                         ~49     !2
         73        IS_SMALLER                                               ~49, !0
         74      > JMPNZ                                                    ~50, ->64
   45    75    >   ECHO                                                     'test%3A%3AstaticTest%28%24a%29%3A+'
         76        ECHO                                                     '%09%09'
         77        INIT_FCALL                                               'microtime'
         78        SEND_VAL                                                 <true>
         79        DO_ICALL                                         $51     
         80        SUB                                              ~52     $51, !1
         81        ECHO                                                     ~52
         82        ECHO                                                     '%0A'
         83      > RETURN                                                   1

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

End of function t

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

End of function statictest

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.34 ms | 1407 KiB | 16 Q