3v4l.org

run code in 300+ PHP versions simultaneously
<?php class integer { private $value; public function __construct(int $value) { $this->value = $value; } public function __invoke(int ...$value) : int { $count = count($value); switch (count($value)) { case 1: $this->value = $value[0]; break; default: throw new Exception('Multiple values given.'); break; } 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/eQQ57
function name:  (null)
number of ops:  8
compiled vars:  !0 = $testi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'integer'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   27     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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eQQ57
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'value'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

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