3v4l.org

run code in 300+ PHP versions simultaneously
<?php // before, in 10.1 class BaseOld { public function __construct() {} public function printTest(): void { print $this->test; } } // after class BaseNew { private bool $test; public function __construct(?bool $test = NULL) { $test = $test ?? TRUE; $this->test = $test; } public function printTest(): void { print $this->test; } } // NOTE: IDENTICAL! class FooOld extends BaseOld { protected bool $test; public function __construct() { parent::__construct(); $this->test = FALSE; } } class FooNew extends BaseNew { protected bool $test; public function __construct() { parent::__construct(); $this->test = FALSE; } } $f = new FooOld(); $f->printTest(); $f = new FooNew(); $f->printTest();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  (null)
number of ops:  11
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   NEW                                              $1      'FooOld'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   39     3        INIT_METHOD_CALL                                         !0, 'printTest'
          4        DO_FCALL                                      0          
   40     5        NEW                                              $5      'FooNew'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $5
   41     8        INIT_METHOD_CALL                                         !0, 'printTest'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class BaseOld:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function __construct

Function printtest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  printTest
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        ECHO                                                     ~0
    8     2      > RETURN                                                   null

End of function printtest

End of class BaseOld.

Class BaseNew:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  __construct
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_INIT                                        !0      null
   14     1        COALESCE                                         ~1      !0
          2        QM_ASSIGN                                        ~1      <true>
          3        ASSIGN                                                   !0, ~1
   15     4        ASSIGN_OBJ                                               'test'
          5        OP_DATA                                                  !0
   16     6      > RETURN                                                   null

End of function __construct

Function printtest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  printTest
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        ECHO                                                     ~0
   19     2      > RETURN                                                   null

End of function printtest

End of class BaseNew.

Class FooOld:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   27     2        ASSIGN_OBJ                                               'test'
          3        OP_DATA                                                  <false>
   28     4      > RETURN                                                   null

End of function __construct

Function printtest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  printTest
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        ECHO                                                     ~0
    8     2      > RETURN                                                   null

End of function printtest

End of class FooOld.

Class FooNew:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   34     2        ASSIGN_OBJ                                               'test'
          3        OP_DATA                                                  <false>
   35     4      > RETURN                                                   null

End of function __construct

Function printtest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UBUSh
function name:  printTest
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        ECHO                                                     ~0
   19     2      > RETURN                                                   null

End of function printtest

End of class FooNew.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.93 ms | 1000 KiB | 13 Q