3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test { public $cb; public function __construct() { // $this->cb is callable here $this->cb = [$this, 'method']; var_dump(is_callable($this->cb)); } private function method() {} } $obj = new Test; // $obj->cb is NOT callable here var_dump(is_callable($obj->cb));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O8C70
function name:  (null)
number of ops:  11
compiled vars:  !0 = $obj
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   NEW                                                  $1      'Test'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   18     3        INIT_FCALL                                                   'var_dump'
          4        INIT_FCALL                                                   'is_callable'
          5        FETCH_OBJ_R                                          ~4      !0, 'cb'
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                             $5      
          8        SEND_VAR                                                     $5
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O8C70
function name:  __construct
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                           ~1      
          1        INIT_ARRAY                                           ~2      ~1
          2        ADD_ARRAY_ELEMENT                                    ~2      'method'
          3        ASSIGN_OBJ                                                   'cb'
          4        OP_DATA                                                      ~2
    9     5        INIT_FCALL                                                   'var_dump'
          6        INIT_FCALL                                                   'is_callable'
          7        FETCH_OBJ_R                                          ~3      'cb'
          8        SEND_VAL                                                     ~3
          9        DO_ICALL                                             $4      
         10        SEND_VAR                                                     $4
         11        DO_ICALL                                                     
   10    12      > RETURN                                                       null

End of function __construct

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

End of function method

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.1 ms | 1585 KiB | 15 Q