3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Product { private ?int $id; private ?string $name; private function __construct(?int $id = null, ?string $name = null) { $this->id = $id; $this->name = $name; var_dump('yep2'); } public static function fromBasicData(int $id, string $name): static { $new = new static($id, $name); var_dump('yep'); return $new; } } $p1 = Product::fromBasicData(5, 'Widget');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZOVc
function name:  (null)
number of ops:  6
compiled vars:  !0 = $p1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'Product', 'fromBasicData'
          1        SEND_VAL                                                 5
          2        SEND_VAL                                                 'Widget'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
          5      > RETURN                                                   1

Class Product:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZOVc
function name:  __construct
number of ops:  10
compiled vars:  !0 = $id, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      null
    9     2        ASSIGN_OBJ                                               'id'
          3        OP_DATA                                                  !0
   10     4        ASSIGN_OBJ                                               'name'
          5        OP_DATA                                                  !1
   11     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAL                                                 'yep2'
          8        DO_ICALL                                                 
   12     9      > RETURN                                                   null

End of function __construct

Function frombasicdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZOVc
function name:  fromBasicData
number of ops:  14
compiled vars:  !0 = $id, !1 = $name, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        NEW                          static              $3      
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $3
   16     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAL                                                 'yep'
          9        DO_ICALL                                                 
   17    10        VERIFY_RETURN_TYPE                                       !2
         11      > RETURN                                                   !2
   18    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function frombasicdata

End of class Product.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.68 ms | 1407 KiB | 15 Q