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() {} } $b = new Bar; var_dump($foo->isCallable($a)); var_dump($foo->isCallable($b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MTqrv
function name:  (null)
number of ops:  21
compiled vars:  !0 = $foo, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   10     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMTqrv%3A10%240'
          4        ASSIGN                                                   !1, ~6
   14     5        NEW                                              $8      'Bar'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $8
   16     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'isCallable'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $11     
         12        SEND_VAR                                                 $11
         13        DO_ICALL                                                 
   17    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !0, 'isCallable'
         16        SEND_VAR_EX                                              !2
         17        DO_FCALL                                      0  $13     
         18        SEND_VAR                                                 $13
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FMTqrv%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MTqrv
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%2FMTqrv%3A10%240

Class Foo:
Function iscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MTqrv
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/MTqrv
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

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.48 ms | 1400 KiB | 17 Q