3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClass { public function doIt() { echo 'done'; } } function is_instance_callable(array $definition) { return isset($definition[0], $definition[1]) && in_array($definition[1], get_class_methods($definition[0]) ?? [], true); } $callable = [TestClass::class, 'doIt', 'param' => 'myParam']; var_dump(is_instance_callable($callable));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qleNu
function name:  (null)
number of ops:  8
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'is_instance_callable'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function is_instance_callable:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/qleNu
function name:  is_instance_callable
number of ops:  21
compiled vars:  !0 = $definition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~1      !0, 0
          2      > JMPZ_EX                                          ~1      ~1, ->5
          3    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~2      !0, 1
          4        BOOL                                             ~1      ~2
          5    > > JMPZ_EX                                          ~1      ~1, ->19
          6    >   INIT_FCALL                                               'in_array'
          7        FETCH_DIM_R                                      ~3      !0, 1
          8        SEND_VAL                                                 ~3
          9        INIT_FCALL                                               'get_class_methods'
         10        FETCH_DIM_R                                      ~4      !0, 0
         11        SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13        COALESCE                                         ~6      $5
         14        QM_ASSIGN                                        ~6      <array>
         15        SEND_VAL                                                 ~6
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $7      
         18        BOOL                                             ~1      $7
         19    > > RETURN                                                   ~1
   14    20*     > RETURN                                                   null

End of function is_instance_callable

Class TestClass:
Function doit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qleNu
function name:  doIt
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'done'
    8     1      > RETURN                                                   null

End of function doit

End of class TestClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.35 ms | 1003 KiB | 17 Q