3v4l.org

run code in 500+ PHP versions simultaneously
<?php class B { public readonly int $x; public function getX(): int { return $this->x; } } class C extends B { // Redeclare to make it writable. public readonly int $x; public function __construct() { $this->x = 5; } } $c = new C; print $c->getX();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rn1CR
function name:  (null)
number of ops:  7
compiled vars:  !0 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $1      'C'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   19     3        INIT_METHOD_CALL                                             !0, 'getX'
          4        DO_FCALL                                          0  $4      
          5        ECHO                                                         $4
          6      > RETURN                                                       1

Class B:
Function getx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rn1CR
function name:  getX
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                          ~0      'x'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
    7     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getx

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/Rn1CR
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_OBJ                                                   'x'
          1        OP_DATA                                                      5
   15     2      > RETURN                                                       null

End of function __construct

Function getx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rn1CR
function name:  getX
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                          ~0      'x'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
    7     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getx

End of class C.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
141.13 ms | 1560 KiB | 13 Q