3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct( public ?string $prop = null, ) {} } class Bar extends Foo { public function __construct( public ?string $bar = null, ) { parent::__construct(); } } // Echoes nothing, but it works as expected. echo (new Bar())->prop;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LSIXv
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $0      'Bar'
          1        DO_FCALL                                      0          
          2        FETCH_OBJ_R                                      ~2      $0, 'prop'
          3        ECHO                                                     ~2
   21     4      > RETURN                                                   1

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

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LSIXv
function name:  __construct
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV_INIT                                        !0      null
          1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   15     3        INIT_STATIC_METHOD_CALL                                  
          4        DO_FCALL                                      0          
   16     5      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.28 ms | 994 KiB | 13 Q