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; } public function getAge() { return $this->age; } } class BlackBear { private $name; public function setNameAndAge($name, $age) { $this->name = $name; $this->setAge($age); } } $bear1 = new Bear(); $bear1->setAge(35); $bear2 = new BlackBear(); $bear2->setNameAndAge('Harry', 45); var_dump($bear1->getAge()); var_dump($bear2->getAge());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0CK9i
function name:  (null)
number of ops:  24
compiled vars:  !0 = $bear1, !1 = $bear2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   NEW                                              $2      'Bear'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   34     3        INIT_METHOD_CALL                                         !0, 'setAge'
          4        SEND_VAL_EX                                              35
          5        DO_FCALL                                      0          
   36     6        NEW                                              $6      'BlackBear'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   37     9        INIT_METHOD_CALL                                         !1, 'setNameAndAge'
         10        SEND_VAL_EX                                              'Harry'
         11        SEND_VAL_EX                                              45
         12        DO_FCALL                                      0          
   39    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !0, 'getAge'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
   40    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !1, 'getAge'
         20        DO_FCALL                                      0  $12     
         21        SEND_VAR                                                 $12
         22        DO_ICALL                                                 
         23      > 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/0CK9i
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

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

End of function getage

End of class Bear.

Class BlackBear:
Function setnameandage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0CK9i
function name:  setNameAndAge
number of ops:  8
compiled vars:  !0 = $name, !1 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
   28     4        INIT_METHOD_CALL                                         'setAge'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
   29     7      > RETURN                                                   null

End of function setnameandage

End of class BlackBear.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.86 ms | 1400 KiB | 15 Q