3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bear { private $age = 0; public function setAge($age) { if ($age < 0) { throw new Exception('Bear cannot have negative age dumbass'); } $this->age = $age; } } $bear1 = new Bear(); $bear1->setAge(25); $bear2 = new Bear(); $bear2->setAge(35); var_dump($bear1); var_dump($bear2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7bRV4
function name:  (null)
number of ops:  19
compiled vars:  !0 = $bear1, !1 = $bear2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'Bear'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   17     3        INIT_METHOD_CALL                                         !0, 'setAge'
          4        SEND_VAL_EX                                              25
          5        DO_FCALL                                      0          
   19     6        NEW                                              $6      'Bear'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   20     9        INIT_METHOD_CALL                                         !1, 'setAge'
         10        SEND_VAL_EX                                              35
         11        DO_FCALL                                      0          
   22    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   23    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Bear:
Function setage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7bRV4
function name:  setAge
number of ops:  10
compiled vars:  !0 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        IS_SMALLER                                               !0, 0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   NEW                                              $2      'Exception'
          4        SEND_VAL_EX                                              'Bear+cannot+have+negative+age+dumbass'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   12     7    >   ASSIGN_OBJ                                               'age'
          8        OP_DATA                                                  !0
   13     9      > RETURN                                                   null

End of function setage

End of class Bear.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.99 ms | 1396 KiB | 15 Q