3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public int $a; public function __construct(int $a = 1) { $this->a = $a; } } class B extends A { public string $b; public function __construct(string $b = 'hello') { $this->b = $b; } } $b = new B(); $b->a=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/1530v
function name:  (null)
number of ops:  12
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $1      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   18     3        ASSIGN_OBJ                                                   !0, 'a'
          4        OP_DATA                                                      1
   19     5        INIT_FCALL                                                   'var_dump'
          6        FETCH_OBJ_R                                          ~5      !0, 'a'
          7        SEND_VAL                                                     ~5
          8        FETCH_OBJ_R                                          ~6      !0, 'b'
          9        SEND_VAL                                                     ~6
         10        DO_ICALL                                                     
         11      > RETURN                                                       1

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

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.24 ms | 2107 KiB | 14 Q