3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C{ public $foo=5; public function foo(){echo "foo is evidently a callable function!\n";} } $o=new C(); if(is_int($o->foo)){ echo "foo is an integer!\n"; } if(is_callable($o->foo)){ echo "foo IS callable!\n"; }else{ echo "foo IS NOT callable!\n"; } $o->foo = function () { echo "lol imma function\n"; }; if(is_callable($o->foo)){ echo "foo IS callable!\n"; }else{ echo "foo IS NOT callable!\n"; } $o->foo(); ($o->foo)();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
Branch analysis from position: 25
Branch analysis from position: 7
filename:       /in/ma2fi
function name:  (null)
number of ops:  32
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    7     3        FETCH_OBJ_R                                      ~4      !0, 'foo'
          4        TYPE_CHECK                                   16          ~4
          5      > JMPZ                                                     ~5, ->7
    8     6    >   ECHO                                                     'foo+is+an+integer%21%0A'
   10     7    >   INIT_FCALL                                               'is_callable'
          8        FETCH_OBJ_R                                      ~6      !0, 'foo'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
         11      > JMPZ                                                     $7, ->14
   11    12    >   ECHO                                                     'foo+IS+callable%21%0A'
   10    13      > JMP                                                      ->15
   13    14    >   ECHO                                                     'foo+IS+NOT+callable%21%0A'
   15    15    >   DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         16        ASSIGN_OBJ                                               !0, 'foo'
         17        OP_DATA                                                  ~9
   16    18        INIT_FCALL                                               'is_callable'
         19        FETCH_OBJ_R                                      ~10     !0, 'foo'
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                         $11     
         22      > JMPZ                                                     $11, ->25
   17    23    >   ECHO                                                     'foo+IS+callable%21%0A'
   16    24      > JMP                                                      ->26
   19    25    >   ECHO                                                     'foo+IS+NOT+callable%21%0A'
   21    26    >   INIT_METHOD_CALL                                         !0, 'foo'
         27        DO_FCALL                                      0          
   22    28        FETCH_OBJ_R                                      ~13     !0, 'foo'
         29        INIT_DYNAMIC_CALL                                        ~13
         30        DO_FCALL                                      0          
         31      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ma2fi
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     'lol+imma+function%0A'
          1      > RETURN                                                   null

End of Dynamic Function 0

Class C:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ma2fi
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'foo+is+evidently+a+callable+function%21%0A'
          1      > RETURN                                                   null

End of function foo

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.82 ms | 1018 KiB | 14 Q