3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class DemoFile { private Bar $foo; public function __construct(?Bar $foo = null) { $this->foo = $foo ?? new Bar(); } public function work(): void { echo $this->foo::class; } } class Bar {} (new DemoFile(null))->work(); final class DemoFile2 { public function __construct(private ?Bar $foo = new Bar()) { $this->foo = $foo ?? new Bar(); } public function work(): void { echo $this->foo::class; } } (new DemoFile2(null))->work();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8f3SR
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $0      'DemoFile'
          1        SEND_VAL_EX                                                  null
          2        DO_FCALL                                          0          
          3        INIT_METHOD_CALL                                             $0, 'work'
          4        DO_FCALL                                          0          
   34     5        NEW                                                  $3      'DemoFile2'
          6        SEND_VAL_EX                                                  null
          7        DO_FCALL                                          0          
          8        INIT_METHOD_CALL                                             $3, 'work'
          9        DO_FCALL                                          0          
         10      > RETURN                                                       1

Class DemoFile:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8f3SR
function name:  __construct
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                            !0      null
    8     1        COALESCE                                             ~2      !0
          2        NEW                                                  $3      'Bar'
          3        DO_FCALL                                          0          
          4        QM_ASSIGN                                            ~2      $3
          5        ASSIGN_OBJ                                                   'foo'
          6        OP_DATA                                                      ~2
    9     7      > RETURN                                                       null

End of function __construct

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

End of function work

End of class DemoFile.

Class Bar: [no user functions]
Class DemoFile2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8f3SR
function name:  __construct
number of ops:  10
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   RECV_INIT                                            !0      <const ast>
          1        ASSIGN_OBJ                                                   'foo'
          2        OP_DATA                                                      !0
   25     3        COALESCE                                             ~2      !0
          4        NEW                                                  $3      'Bar'
          5        DO_FCALL                                          0          
          6        QM_ASSIGN                                            ~2      $3
          7        ASSIGN_OBJ                                                   'foo'
          8        OP_DATA                                                      ~2
   26     9      > RETURN                                                       null

End of function __construct

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

End of function work

End of class DemoFile2.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
116.92 ms | 488 KiB | 9 Q