3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. Position 1 = -2
filename:       /in/vsv9u
function name:  (null)
number of ops:  53
compiled vars:  !0 = $foo, !1 = $result
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   8     1        NEW                                              $3      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $3
   9     4        ASSIGN                                                   !1, <array>
  10     5        INIT_FCALL                                               'var_dump'
         6        INIT_FCALL                                               'is_callable'
         7        SEND_VAL                                                 <array>
         8        SEND_VAL                                                 0
         9        FETCH_DIM_W                                      $7      !1, 0
        10        SEND_REF                                                 $7
        11        DO_ICALL                                         $8      
        12        SEND_VAR                                                 $8
        13        DO_ICALL                                                 
  11    14        INIT_FCALL                                               'var_dump'
        15        INIT_FCALL                                               'is_callable'
        16        SEND_VAL                                                 <array>
        17        SEND_VAL                                                 0
        18        FETCH_DIM_W                                      $10     !1, 1
        19        SEND_REF                                                 $10
        20        DO_ICALL                                         $11     
        21        SEND_VAR                                                 $11
        22        DO_ICALL                                                 
  12    23        INIT_FCALL                                               'var_dump'
        24        INIT_FCALL                                               'is_callable'
        25        INIT_ARRAY                                       ~13     !0
        26        ADD_ARRAY_ELEMENT                                ~13     'foo'
        27        SEND_VAL                                                 ~13
        28        SEND_VAL                                                 0
        29        FETCH_DIM_W                                      $14     !1, 2
        30        SEND_REF                                                 $14
        31        DO_ICALL                                         $15     
        32        SEND_VAR                                                 $15
        33        DO_ICALL                                                 
  13    34        INIT_FCALL                                               'var_dump'
        35        INIT_FCALL                                               'is_callable'
        36        INIT_ARRAY                                       ~17     !0
        37        ADD_ARRAY_ELEMENT                                ~17     'bar'
        38        SEND_VAL                                                 ~17
        39        SEND_VAL                                                 0
        40        FETCH_DIM_W                                      $18     !1, 3
        41        SEND_REF                                                 $18
        42        DO_ICALL                                         $19     
        43        SEND_VAR                                                 $19
        44        DO_ICALL                                                 
  14    45        INIT_FCALL                                               'var_dump'
        46        SEND_VAR                                                 !1
        47        DO_ICALL                                                 
  15    48        INIT_FCALL                                               'array_map'
        49        SEND_VAL                                                 'call_user_func'
        50        SEND_VAR                                                 !1
        51        DO_ICALL                                                 
        52      > RETURN                                                   1

Class Foo:
Function foo:
Finding entry points
Branch analysis from position: 0
Jump found. 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
Jump found. 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 7.2.0