3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $c = 0; public function __construct($c) { $this->c = $c; print($this->c); } } class B extends A { public function __construct($c) { parent::__construct(++$this->c > 0 ? ++$c : -1); } } $b = new B(2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UDiJU
function name:  (null)
number of ops:  5
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'B'
          1        SEND_VAL_EX                                              2
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

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

End of function __construct

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UDiJU
function name:  __construct
number of ops:  12
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_STATIC_METHOD_CALL                                  
          2        PRE_INC_OBJ                                      ~1      'c'
          3        IS_SMALLER                                               0, ~1
          4      > JMPZ                                                     ~2, ->8
          5    >   PRE_INC                                          ~3      !0
          6        QM_ASSIGN                                        ~4      ~3
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~4      -1
          9    >   SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0          
   18    11      > RETURN                                                   null

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.38 ms | 1395 KiB | 13 Q