3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public static function bar($x,$y){ return $x*$y; } public static function met1(){ $met = $bar; //return static:: } } $s = microtime(true); for($x = 0; $x < 10000; $x++ ){ $a = is_callable(array('foo', 'bar')); } echo round(microtime(true) - $s,5)."\n"; $s = microtime(true); for($x = 0; $x < 10000; $x++ ){ $a = method_exists('foo', 'bar'); } echo round(microtime(true) - $s,5)."\n"; $s = microtime(true); $met = array('foo', 'bar'); for($x = 0; $x < 10000; $x++ ){ $a = $met instanceof \Callable; } echo round(microtime(true) - $s,5)."\n";
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 = 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 29
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 54
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 54
Branch analysis from position: 59
Branch analysis from position: 54
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 29
Branch analysis from position: 37
Branch analysis from position: 29
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/5j9ag
function name:  (null)
number of ops:  70
compiled vars:  !0 = $s, !1 = $x, !2 = $a, !3 = $met
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
   15     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->11
   16     6    >   INIT_FCALL                                               'is_callable'
          7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
   15    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 10000
         12      > JMPNZ                                                    ~10, ->6
   18    13    >   INIT_FCALL                                               'round'
         14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $11     
         17        SUB                                              ~12     $11, !0
         18        SEND_VAL                                                 ~12
         19        SEND_VAL                                                 5
         20        DO_ICALL                                         $13     
         21        CONCAT                                           ~14     $13, '%0A'
         22        ECHO                                                     ~14
   21    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !0, $15
   22    27        ASSIGN                                                   !1, 0
         28      > JMP                                                      ->35
   23    29    >   INIT_FCALL                                               'method_exists'
         30        SEND_VAL                                                 'foo'
         31        SEND_VAL                                                 'bar'
         32        DO_ICALL                                         $18     
         33        ASSIGN                                                   !2, $18
   22    34        PRE_INC                                                  !1
         35    >   IS_SMALLER                                               !1, 10000
         36      > JMPNZ                                                    ~21, ->29
   25    37    >   INIT_FCALL                                               'round'
         38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $22     
         41        SUB                                              ~23     $22, !0
         42        SEND_VAL                                                 ~23
         43        SEND_VAL                                                 5
         44        DO_ICALL                                         $24     
         45        CONCAT                                           ~25     $24, '%0A'
         46        ECHO                                                     ~25
   27    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $26     
         50        ASSIGN                                                   !0, $26
   28    51        ASSIGN                                                   !3, <array>
   29    52        ASSIGN                                                   !1, 0
         53      > JMP                                                      ->57
   30    54    >   INSTANCEOF                                       ~30     !3, 'Callable'
         55        ASSIGN                                                   !2, ~30
   29    56        PRE_INC                                                  !1
         57    >   IS_SMALLER                                               !1, 10000
         58      > JMPNZ                                                    ~33, ->54
   32    59    >   INIT_FCALL                                               'round'
         60        INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $34     
         63        SUB                                              ~35     $34, !0
         64        SEND_VAL                                                 ~35
         65        SEND_VAL                                                 5
         66        DO_ICALL                                         $36     
         67        CONCAT                                           ~37     $36, '%0A'
         68        ECHO                                                     ~37
         69      > RETURN                                                   1

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

End of function bar

Function met1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5j9ag
function name:  met1
number of ops:  2
compiled vars:  !0 = $met, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, !1
   11     1      > RETURN                                                   null

End of function met1

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.57 ms | 1404 KiB | 21 Q