3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function PublicMethod() {} private function PrivateMethod() {} public static function PublicStaticMethod() {} private static function PrivateStaticMethod() {} } $foo = new Foo(); $callbacks = array( array($foo, 'PublicMethod'), array($foo, 'PrivateMethod'), array($foo, 'PublicStaticMethod'), array($foo, 'PrivateStaticMethod'), array('Foo', 'PublicMethod'), array('Foo', 'PrivateMethod'), array('Foo', 'PublicStaticMethod'), array('Foo', 'PrivateStaticMethod'), ); foreach ($callbacks as $callback) { var_dump($callback); var_dump(method_exists($callback[0], $callback[1])); // 0: object / class name, 1: method name var_dump(is_callable($callback)); echo str_repeat('-', 40), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 47
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 47
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/mBOlC
function name:  (null)
number of ops:  49
compiled vars:  !0 = $foo, !1 = $callbacks, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   12     3        INIT_ARRAY                                       ~6      !0
          4        ADD_ARRAY_ELEMENT                                ~6      'PublicMethod'
          5        INIT_ARRAY                                       ~7      ~6
   13     6        INIT_ARRAY                                       ~8      !0
          7        ADD_ARRAY_ELEMENT                                ~8      'PrivateMethod'
          8        ADD_ARRAY_ELEMENT                                ~7      ~8
   14     9        INIT_ARRAY                                       ~9      !0
         10        ADD_ARRAY_ELEMENT                                ~9      'PublicStaticMethod'
         11        ADD_ARRAY_ELEMENT                                ~7      ~9
   15    12        INIT_ARRAY                                       ~10     !0
         13        ADD_ARRAY_ELEMENT                                ~10     'PrivateStaticMethod'
         14        ADD_ARRAY_ELEMENT                                ~7      ~10
   12    15        ADD_ARRAY_ELEMENT                                ~7      <array>
         16        ADD_ARRAY_ELEMENT                                ~7      <array>
         17        ADD_ARRAY_ELEMENT                                ~7      <array>
         18        ADD_ARRAY_ELEMENT                                ~7      <array>
   11    19        ASSIGN                                                   !1, ~7
   22    20      > FE_RESET_R                                       $12     !1, ->47
         21    > > FE_FETCH_R                                               $12, !2, ->47
   23    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
   24    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'method_exists'
         27        FETCH_DIM_R                                      ~14     !2, 0
         28        SEND_VAL                                                 ~14
         29        FETCH_DIM_R                                      ~15     !2, 1
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32        SEND_VAR                                                 $16
         33        DO_ICALL                                                 
   25    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'is_callable'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $18     
         38        SEND_VAR                                                 $18
         39        DO_ICALL                                                 
   26    40        INIT_FCALL                                               'str_repeat'
         41        SEND_VAL                                                 '-'
         42        SEND_VAL                                                 40
         43        DO_ICALL                                         $20     
         44        ECHO                                                     $20
         45        ECHO                                                     '%0A'
   22    46      > JMP                                                      ->21
         47    >   FE_FREE                                                  $12
   27    48      > RETURN                                                   1

Class Foo:
Function publicmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mBOlC
function name:  PublicMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   null

End of function publicmethod

Function privatemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mBOlC
function name:  PrivateMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function privatemethod

Function publicstaticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mBOlC
function name:  PublicStaticMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function publicstaticmethod

Function privatestaticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mBOlC
function name:  PrivateStaticMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   null

End of function privatestaticmethod

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.3 ms | 1400 KiB | 21 Q