3v4l.org

run code in 300+ PHP versions simultaneously
<?php class integer { private $value; public function __construct(int ...$value) { switch (count($value)) { case 0: break; case 1: $this->value = $value[0]; break; default: throw new Exception('Multiple values given.'); } } public function __invoke(int ...$value) : int { switch (count($value)) { case 0: break; case 1: $this->value = $value[0]; break; default: throw new Exception('Multiple values given.'); } return $this->value; } } $testi = new integer(1); $testi(2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G12Th
function name:  (null)
number of ops:  8
compiled vars:  !0 = $testi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'integer'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   35     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAL_EX                                              2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class integer:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
filename:       /in/G12Th
function name:  __construct
number of ops:  18
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_VARIADIC                                    !0      
    8     1        COUNT                                            ~1      !0
    9     2        CASE                                                     ~1, 0
          3      > JMPNZ                                                    ~2, ->7
   11     4    >   CASE                                                     ~1, 1
          5      > JMPNZ                                                    ~2, ->8
          6    > > JMP                                                      ->12
   10     7    > > JMP                                                      ->16
   12     8    >   FETCH_DIM_R                                      ~4      !0, 0
          9        ASSIGN_OBJ                                               'value'
         10        OP_DATA                                                  ~4
   13    11      > JMP                                                      ->16
   15    12    >   NEW                                              $5      'Exception'
         13        SEND_VAL_EX                                              'Multiple+values+given.'
         14        DO_FCALL                                      0          
         15      > THROW                                         0          $5
         16    >   FREE                                                     ~1
   17    17      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
filename:       /in/G12Th
function name:  __invoke
number of ops:  22
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV_VARIADIC                                    !0      
   21     1        COUNT                                            ~1      !0
   22     2        CASE                                                     ~1, 0
          3      > JMPNZ                                                    ~2, ->7
   24     4    >   CASE                                                     ~1, 1
          5      > JMPNZ                                                    ~2, ->8
          6    > > JMP                                                      ->12
   23     7    > > JMP                                                      ->16
   25     8    >   FETCH_DIM_R                                      ~4      !0, 0
          9        ASSIGN_OBJ                                               'value'
         10        OP_DATA                                                  ~4
   26    11      > JMP                                                      ->16
   28    12    >   NEW                                              $5      'Exception'
         13        SEND_VAL_EX                                              'Multiple+values+given.'
         14        DO_FCALL                                      0          
         15      > THROW                                         0          $5
         16    >   FREE                                                     ~1
   30    17        FETCH_OBJ_R                                      ~7      'value'
         18        VERIFY_RETURN_TYPE                                       ~7
         19      > RETURN                                                   ~7
   31    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of function __invoke

End of class integer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.45 ms | 1399 KiB | 13 Q