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 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 30
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 30
Branch analysis from position: 37
Branch analysis from position: 30
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/0QKem
function name:  (null)
number of ops:  47
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    >   IS_SMALLER                                               !2, 100000
         13      > JMPNZ                                                    ~11, ->7
   18    14    >   INIT_FCALL                                               'printf'
         15        SEND_VAL                                                 'time%3D%25f+%5B%25d%5D%0A'
         16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $12     
         19        SUB                                              ~13     $12, !0
         20        SEND_VAL                                                 ~13
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
   20    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !0, $15
   21    27        ASSIGN                                                   !1, 0
   23    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->35
   24    30    >   INIT_DYNAMIC_CALL                                        !3
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0  $19     
         33        ASSIGN_OP                                     1          !1, $19
   23    34        PRE_INC                                                  !2
         35    >   IS_SMALLER                                               !2, 100000
         36      > JMPNZ                                                    ~22, ->30
   27    37    >   INIT_FCALL                                               'printf'
         38        SEND_VAL                                                 'time%3D%25f+%5B%25d%5D%0A'
         39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $23     
         42        SUB                                              ~24     $23, !0
         43        SEND_VAL                                                 ~24
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Class call:
Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0QKem
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:
146.81 ms | 1400 KiB | 17 Q