3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f() {} class C { function f() {} static function s() {} function __invoke() { echo "In __invoke()\n"; var_dump(func_get_args()); } } $obj = new C; $anon = function() {}; function check_callable(callable $f) {} echo "f()\n"; check_callable('f'); var_dump(is_callable('f')); echo "C::s()\n"; check_callable(array('C', 's')); var_dump(is_callable(array('C', 's'))); check_callable('C::s'); var_dump(is_callable('C::s')); echo "Closure\n"; check_callable($anon); var_dump(is_callable($anon)); echo "C::__invoke()\n"; check_callable($obj); var_dump(is_callable($obj)); echo "C::f()\n"; check_callable(array($obj, 'f')); var_dump(is_callable(array($obj, 'f')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GSGhq
function name:  (null)
number of ops:  69
compiled vars:  !0 = $obj, !1 = $anon
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $2      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    6     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGSGhq%3A6%240'
          4        ASSIGN                                                   !1, ~5
   10     5        ECHO                                                     'f%28%29%0A'
   11     6        INIT_FCALL                                               'check_callable'
          7        SEND_VAL                                                 'f'
          8        DO_FCALL                                      0          
   12     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'is_callable'
         11        SEND_VAL                                                 'f'
         12        DO_ICALL                                         $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
   14    15        ECHO                                                     'C%3A%3As%28%29%0A'
   15    16        INIT_FCALL                                               'check_callable'
         17        SEND_VAL                                                 <array>
         18        DO_FCALL                                      0          
   16    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'is_callable'
         21        SEND_VAL                                                 <array>
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                                 
   17    25        INIT_FCALL                                               'check_callable'
         26        SEND_VAL                                                 'C%3A%3As'
         27        DO_FCALL                                      0          
   18    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'is_callable'
         30        SEND_VAL                                                 'C%3A%3As'
         31        DO_ICALL                                         $14     
         32        SEND_VAR                                                 $14
         33        DO_ICALL                                                 
   20    34        ECHO                                                     'Closure%0A'
   21    35        INIT_FCALL                                               'check_callable'
         36        SEND_VAR                                                 !1
         37        DO_FCALL                                      0          
   22    38        INIT_FCALL                                               'var_dump'
         39        INIT_FCALL                                               'is_callable'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                         $17     
         42        SEND_VAR                                                 $17
         43        DO_ICALL                                                 
   24    44        ECHO                                                     'C%3A%3A__invoke%28%29%0A'
   25    45        INIT_FCALL                                               'check_callable'
         46        SEND_VAR                                                 !0
         47        DO_FCALL                                      0          
   26    48        INIT_FCALL                                               'var_dump'
         49        INIT_FCALL                                               'is_callable'
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $20     
         52        SEND_VAR                                                 $20
         53        DO_ICALL                                                 
   28    54        ECHO                                                     'C%3A%3Af%28%29%0A'
   29    55        INIT_FCALL                                               'check_callable'
         56        INIT_ARRAY                                       ~22     !0
         57        ADD_ARRAY_ELEMENT                                ~22     'f'
         58        SEND_VAL                                                 ~22
         59        DO_FCALL                                      0          
   30    60        INIT_FCALL                                               'var_dump'
         61        INIT_FCALL                                               'is_callable'
         62        INIT_ARRAY                                       ~24     !0
         63        ADD_ARRAY_ELEMENT                                ~24     'f'
         64        SEND_VAL                                                 ~24
         65        DO_ICALL                                         $25     
         66        SEND_VAR                                                 $25
         67        DO_ICALL                                                 
         68      > RETURN                                                   1

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

End of function f

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

End of function %00%7Bclosure%7D%2Fin%2FGSGhq%3A6%240

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

End of function check_callable

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

End of function f

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

End of function s

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GSGhq
function name:  __invoke
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ECHO                                                     'In+__invoke%28%29%0A'
          1        INIT_FCALL                                               'var_dump'
          2        FUNC_GET_ARGS                                    ~0      
          3        SEND_VAL                                                 ~0
          4        DO_ICALL                                                 
          5      > RETURN                                                   null

End of function __invoke

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.34 ms | 1407 KiB | 23 Q