3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A {} class B {} class C {} class Test { public function __construct( public A $foo, public B $bar, public ?C $baz = null ) { $this->baz = $baz ?? new C; } } $test = new Test(new A, new B); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9DIqq
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $1      'Test'
          1        NEW                                                  $2      'A'
          2        DO_FCALL                                          0          
          3        SEND_VAR_NO_REF_EX                                           $2
          4        NEW                                                  $4      'B'
          5        DO_FCALL                                          0          
          6        SEND_VAR_NO_REF_EX                                           $4
          7        DO_FCALL                                          0          
          8        ASSIGN                                                       !0, $1
   19     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

Class A: [no user functions]
Class B: [no user functions]
Class C: [no user functions]
Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9DIqq
function name:  __construct
number of ops:  16
compiled vars:  !0 = $foo, !1 = $bar, !2 = $baz
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        RECV                                                 !1      
   11     2        RECV_INIT                                            !2      null
    9     3        ASSIGN_OBJ                                                   'foo'
          4        OP_DATA                                                      !0
   10     5        ASSIGN_OBJ                                                   'bar'
          6        OP_DATA                                                      !1
   11     7        ASSIGN_OBJ                                                   'baz'
          8        OP_DATA                                                      !2
   13     9        COALESCE                                             ~4      !2
         10        NEW                                                  $5      'C'
         11        DO_FCALL                                          0          
         12        QM_ASSIGN                                            ~4      $5
         13        ASSIGN_OBJ                                                   'baz'
         14        OP_DATA                                                      ~4
   14    15      > RETURN                                                       null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.05 ms | 1703 KiB | 14 Q