3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Yoba { private int $age; public function getAge () : int { return $this->age; } public function setAge (int $age) : void { if (!$this->ageIsValid($age)) { throw new Exception("0 < \$age <= 100, passed " . $age); } $this->age = $age; } public function ageIsValid (int $age) : bool { if (($age > 0) && ($age <= 100)) { return true; } return false; } } $yo = new Yoba(); $yo->setAge(10); echo $yo->getAge(); $yo->setAge(1000); echo $yo->getAge();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ldLa
function name:  (null)
number of ops:  16
compiled vars:  !0 = $yo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Yoba'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'setAge'
          4        SEND_VAL_EX                                              10
          5        DO_FCALL                                      0          
   27     6        INIT_METHOD_CALL                                         !0, 'getAge'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   28     9        INIT_METHOD_CALL                                         !0, 'setAge'
         10        SEND_VAL_EX                                              1000
         11        DO_FCALL                                      0          
   29    12        INIT_METHOD_CALL                                         !0, 'getAge'
         13        DO_FCALL                                      0  $7      
         14        ECHO                                                     $7
         15      > RETURN                                                   1

Class Yoba:
Function getage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ldLa
function name:  getAge
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'age'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
    8     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getage

Function setage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ldLa
function name:  setAge
number of ops:  14
compiled vars:  !0 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_METHOD_CALL                                         'ageIsValid'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->11
   12     6    >   NEW                                              $3      'Exception'
          7        CONCAT                                           ~4      '0+%3C+%24age+%3C%3D+100%2C+passed+', !0
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $3
   14    11    >   ASSIGN_OBJ                                               'age'
         12        OP_DATA                                                  !0
   15    13      > RETURN                                                   null

End of function setage

Function ageisvalid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/7ldLa
function name:  ageIsValid
number of ops:  10
compiled vars:  !0 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        IS_SMALLER                                       ~1      0, !0
          2      > JMPZ_EX                                          ~1      ~1, ->5
          3    >   IS_SMALLER_OR_EQUAL                              ~2      !0, 100
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->7
   19     6    > > RETURN                                                   <true>
   21     7    > > RETURN                                                   <false>
   22     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function ageisvalid

End of class Yoba.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.55 ms | 1000 KiB | 13 Q