3v4l.org

run code in 300+ PHP versions simultaneously
<?php class call { public function __invoke($a = 0) { return $a++; } } $t = microtime(true); $sum = 0; for ($i = 0; i < 100000; $i++) { $sum += $c->__invoke($i); } printf("time=%f [%d]\n", microtime(true) - $t, $sum); $t = microtime(true); $sum = 0; for ($i = 0; i < 100000; $i++) { $sum += $c($i); } printf("time=%f [%d]\n", microtime(true) - $t, $sum);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 31
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 31
Branch analysis from position: 39
Branch analysis from position: 31
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/cUSA4
function name:  (null)
number of ops:  49
compiled vars:  !0 = $t, !1 = $sum, !2 = $i, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
   12     4        ASSIGN                                                   !1, 0
   14     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->12
   15     7    >   INIT_METHOD_CALL                                         !3, '__invoke'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0  $8      
         10        ASSIGN_OP                                     1          !1, $8
   14    11        PRE_INC                                                  !2
         12    >   FETCH_CONSTANT                                   ~11     'i'
         13        IS_SMALLER                                               ~11, 100000
         14      > JMPNZ                                                    ~12, ->7
   18    15    >   INIT_FCALL                                               'printf'
         16        SEND_VAL                                                 'time%3D%25f+%5B%25d%5D%0A'
         17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $13     
         20        SUB                                              ~14     $13, !0
         21        SEND_VAL                                                 ~14
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $16     
         27        ASSIGN                                                   !0, $16
   21    28        ASSIGN                                                   !1, 0
   23    29        ASSIGN                                                   !2, 0
         30      > JMP                                                      ->36
   24    31    >   INIT_DYNAMIC_CALL                                        !3
         32        SEND_VAR_EX                                              !2
         33        DO_FCALL                                      0  $20     
         34        ASSIGN_OP                                     1          !1, $20
   23    35        PRE_INC                                                  !2
         36    >   FETCH_CONSTANT                                   ~23     'i'
         37        IS_SMALLER                                               ~23, 100000
         38      > JMPNZ                                                    ~24, ->31
   27    39    >   INIT_FCALL                                               'printf'
         40        SEND_VAL                                                 'time%3D%25f+%5B%25d%5D%0A'
         41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $25     
         44        SUB                                              ~26     $25, !0
         45        SEND_VAL                                                 ~26
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Class call:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cUSA4
function name:  __invoke
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      0
    7     1        POST_INC                                         ~1      !0
          2      > RETURN                                                   ~1
    8     3*     > RETURN                                                   null

End of function __invoke

End of class call.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.08 ms | 1405 KiB | 17 Q