3v4l.org

run code in 300+ PHP versions simultaneously
<?php use function PHPStan\dumpType; use function PHPStan\Testing\assertType; class A { public function __construct(public ?B $b) {} } class B { public function __construct(public ?C $c) {} } class C { public function __construct(public ?D $d) {} } class D {} $a = new A(new B(null)); var_dump($a->b?->c?->d ?? 'boom!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVRj1
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'A'
          1        NEW                                              $2      'B'
          2        SEND_VAL_EX                                              null
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   19     7        INIT_FCALL                                               'var_dump'
          8        FETCH_OBJ_IS                                     ~6      !0, 'b'
          9        JMP_NULL                                         ~8      ~6
         10        FETCH_OBJ_IS                                     ~7      ~6, 'c'
         11        JMP_NULL                                         ~8      ~7
         12        FETCH_OBJ_IS                                     ~8      ~7, 'd'
         13        COALESCE                                         ~9      ~8
         14        QM_ASSIGN                                        ~9      'boom%21'
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVRj1
function name:  __construct
number of ops:  4
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'b'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVRj1
function name:  __construct
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'c'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVRj1
function name:  __construct
number of ops:  4
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'd'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

End of class C.

Class D: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.51 ms | 1018 KiB | 14 Q