3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Age { public function __construct(readonly public int $age) { if (0 > $age) { throw new DomainException('Age must be positive integer. "' . $age . '" provided.'); } } public function min(Age $comparingAge): Age { return min($this, $comparingAge); } } $firstAge = new Age(33); $secondAge = new Age(22); $minAge = $firstAge->min($secondAge); var_dump($minAge);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VvrQN
function name:  (null)
number of ops:  16
compiled vars:  !0 = $firstAge, !1 = $secondAge, !2 = $minAge
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $3      'Age'
          1        SEND_VAL_EX                                                  33
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   16     4        NEW                                                  $6      'Age'
          5        SEND_VAL_EX                                                  22
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $6
   17     8        INIT_METHOD_CALL                                             !0, 'min'
          9        SEND_VAR_EX                                                  !1
         10        DO_FCALL                                          0  $9      
         11        ASSIGN                                                       !2, $9
   18    12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAR                                                     !2
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Class Age:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VvrQN
function name:  __construct
number of ops:  12
compiled vars:  !0 = $age
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                                   'age'
          2        OP_DATA                                                      !0
    5     3        IS_SMALLER                                                   !0, 0
          4      > JMPZ                                                         ~1, ->11
    6     5    >   NEW                                                  $2      'DomainException'
          6        CONCAT                                               ~3      'Age+must+be+positive+integer.+%22', !0
          7        CONCAT                                               ~4      ~3, '%22+provided.'
          8        SEND_VAL_EX                                                  ~4
          9        DO_FCALL                                          0          
         10      > THROW                                             0          $2
    8    11    > > RETURN                                                       null

End of function __construct

Function min:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VvrQN
function name:  min
number of ops:  7
compiled vars:  !0 = $comparingAge
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   11     1        FETCH_THIS                                           ~1      
          2        FRAMELESS_ICALL_2                min                 ~2      ~1, !0
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   12     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function min

End of class Age.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.6 ms | 1351 KiB | 16 Q