3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function foo() { echo(__METHOD__); } public static function bar() { echo (__METHOD__); } } $foo = new Foo; $result = []; var_dump(is_callable(['Foo', 'foo'], 0, $result[0]));//false var_dump(is_callable(['Foo', 'bar'], 0, $result[1]));//true var_dump(is_callable([$foo, 'foo'], 0, $result[2]));//true var_dump(is_callable([$foo, 'bar'], 0, $result[3]));//true var_dump($result); array_map('call_user_func', $result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vsv9u
function name:  (null)
number of ops:  52
compiled vars:  !0 = $foo, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    9     3        ASSIGN                                                   !1, <array>
   10     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'is_callable'
          6        SEND_VAL                                                 <array>
          7        SEND_VAL                                                 0
          8        FETCH_DIM_W                                      $6      !1, 0
          9        SEND_REF                                                 $6
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
   11    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'is_callable'
         15        SEND_VAL                                                 <array>
         16        SEND_VAL                                                 0
         17        FETCH_DIM_W                                      $9      !1, 1
         18        SEND_REF                                                 $9
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
   12    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'is_callable'
         24        INIT_ARRAY                                       ~12     !0
         25        ADD_ARRAY_ELEMENT                                ~12     'foo'
         26        SEND_VAL                                                 ~12
         27        SEND_VAL                                                 0
         28        FETCH_DIM_W                                      $13     !1, 2
         29        SEND_REF                                                 $13
         30        DO_ICALL                                         $14     
         31        SEND_VAR                                                 $14
         32        DO_ICALL                                                 
   13    33        INIT_FCALL                                               'var_dump'
         34        INIT_FCALL                                               'is_callable'
         35        INIT_ARRAY                                       ~16     !0
         36        ADD_ARRAY_ELEMENT                                ~16     'bar'
         37        SEND_VAL                                                 ~16
         38        SEND_VAL                                                 0
         39        FETCH_DIM_W                                      $17     !1, 3
         40        SEND_REF                                                 $17
         41        DO_ICALL                                         $18     
         42        SEND_VAR                                                 $18
         43        DO_ICALL                                                 
   14    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                                 
   15    47        INIT_FCALL                                               'array_map'
         48        SEND_VAL                                                 'call_user_func'
         49        SEND_VAR                                                 !1
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

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

End of function foo

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

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.17 ms | 1400 KiB | 19 Q