3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait callback{ public function __invoke($p){} } class foo { use callback; } $inline = new class { use callback; }; var_dump( is_callable($inline, false, $target), $target, is_callable([$inline, '__invoke'], false, $target), $target, is_callable(new foo, false, $target), $target );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kTN4e
function name:  (null)
number of ops:  33
compiled vars:  !0 = $inline, !1 = $target
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'foo'
    7     1        DECLARE_ANON_CLASS                               <array> 
          2        NEW                                              $3      $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
    9     5        INIT_FCALL                                               'var_dump'
   10     6        INIT_FCALL                                               'is_callable'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <false>
          9        SEND_REF                                                 !1
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
   11    12        SEND_VAR                                                 !1
   12    13        INIT_FCALL                                               'is_callable'
         14        INIT_ARRAY                                       ~7      !0
         15        ADD_ARRAY_ELEMENT                                ~7      '__invoke'
         16        SEND_VAL                                                 ~7
         17        SEND_VAL                                                 <false>
         18        SEND_REF                                                 !1
         19        DO_ICALL                                         $8      
         20        SEND_VAR                                                 $8
   13    21        SEND_VAR                                                 !1
   14    22        INIT_FCALL                                               'is_callable'
         23        NEW                                              $9      'foo'
         24        DO_FCALL                                      0          
         25        SEND_VAR                                                 $9
         26        SEND_VAL                                                 <false>
         27        SEND_REF                                                 !1
         28        DO_ICALL                                         $11     
         29        SEND_VAR                                                 $11
   15    30        SEND_VAR                                                 !1
    9    31        DO_ICALL                                                 
   16    32      > RETURN                                                   1

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

End of function __invoke

End of class callback.

Class foo: [no user functions]
Class class@anonymous: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.67 ms | 1000 KiB | 15 Q