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.'); } } } class PickMinAge { public function __invoke(Age $firstAge, Age $secondAge): Age { return min($firstAge, $secondAge); } } $firstAge = new Age(33); $secondAge = new Age(22); $minAge = (new PickMinAge())($firstAge, $secondAge); var_dump($minAge);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HIUHb
function name:  (null)
number of ops:  19
compiled vars:  !0 = $firstAge, !1 = $secondAge, !2 = $minAge
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $3      'Age'
          1        SEND_VAL_EX                                                  33
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   18     4        NEW                                                  $6      'Age'
          5        SEND_VAL_EX                                                  22
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $6
   19     8        NEW                                                  $9      'PickMinAge'
          9        DO_FCALL                                          0          
         10        INIT_DYNAMIC_CALL                                            $9
         11        SEND_VAR_EX                                                  !0
         12        SEND_VAR_EX                                                  !1
         13        DO_FCALL                                          0  $11     
         14        ASSIGN                                                       !2, $11
   20    15        INIT_FCALL                                                   'var_dump'
         16        SEND_VAR                                                     !2
         17        DO_ICALL                                                     
         18      > 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/HIUHb
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

End of class Age.

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

End of function __invoke

End of class PickMinAge.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.1 ms | 1564 KiB | 16 Q