3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function isCallable($bar) { return is_callable($bar); } } $foo = new Foo; $a = function() {}; class Bar { public function __invoke() {} public function log(){} } $b = new Bar; $c = [$b, 'log']; var_dump($foo->isCallable($a)); var_dump($foo->isCallable($b)); var_dump($foo->isCallable($c));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Mc7u
function name:  (null)
number of ops:  30
compiled vars:  !0 = $foo, !1 = $a, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $4      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   10     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2Mc7u%3A10%240'
          4        ASSIGN                                                   !1, ~7
   14     5        NEW                                              $9      'Bar'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $9
   16     8        INIT_ARRAY                                       ~12     !2
          9        ADD_ARRAY_ELEMENT                                ~12     'log'
         10        ASSIGN                                                   !3, ~12
   18    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'isCallable'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0  $14     
         15        SEND_VAR                                                 $14
         16        DO_ICALL                                                 
   19    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'isCallable'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0  $16     
         21        SEND_VAR                                                 $16
         22        DO_ICALL                                                 
   20    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !0, 'isCallable'
         25        SEND_VAR_EX                                              !3
         26        DO_FCALL                                      0  $18     
         27        SEND_VAR                                                 $18
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F2Mc7u%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Mc7u
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2Mc7u%3A10%240

Class Foo:
Function iscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Mc7u
function name:  isCallable
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'is_callable'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    5     5*     > RETURN                                                   null

End of function iscallable

End of class Foo.

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

End of function __invoke

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

End of function log

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.59 ms | 1400 KiB | 17 Q