3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Document { } class a { function __construct(array $config) { } } class b extends a { protected Document $document; function __construct($document) { if (is_array($document)) { // deprecation warning $this->document = new Document; // get from factory // do config stuff return; } $this->document = $document; } } $x = new b(new Document); var_dump($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H5ck7
function name:  (null)
number of ops:  10
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $1      'b'
          1        NEW                                              $2      'Document'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   33     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class Document: [no user functions]
Class a:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H5ck7
function name:  __construct
number of ops:  2
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1      > 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 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H5ck7
function name:  __construct
number of ops:  11
compiled vars:  !0 = $document
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->8
   20     3    >   NEW                                              $3      'Document'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               'document'
          6        OP_DATA                                                  $3
   23     7      > RETURN                                                   null
   26     8    >   ASSIGN_OBJ                                               'document'
          9        OP_DATA                                                  !0
   27    10      > RETURN                                                   null

End of function __construct

End of class b.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.06 ms | 998 KiB | 14 Q