3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function __construct( public int $a = 1 ) {} } class B extends A { public function __construct( public string $b = 'hello' ) {} } $b = new B(); $b=1; var_dump($b->a, $b->b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qKUlV
function name:  (null)
number of ops:  11
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $1      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   16     3        ASSIGN                                                       !0, 1
   17     4        INIT_FCALL                                                   'var_dump'
          5        FETCH_OBJ_R                                          ~5      !0, 'a'
          6        SEND_VAL                                                     ~5
          7        FETCH_OBJ_R                                          ~6      !0, 'b'
          8        SEND_VAL                                                     ~6
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qKUlV
function name:  __construct
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                            !0      1
          1        ASSIGN_OBJ                                                   'a'
          2        OP_DATA                                                      !0
    6     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/qKUlV
function name:  __construct
number of ops:  4
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                            !0      'hello'
          1        ASSIGN_OBJ                                                   'b'
          2        OP_DATA                                                      !0
   12     3      > RETURN                                                       null

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.69 ms | 1735 KiB | 14 Q