3v4l.org

run code in 300+ PHP versions simultaneously
<?php class shapeClass { // public function __set($name, $value) { // //if (!property_exists($this, $name)) { // throw new Exception("No such property: $name"); // //} // //$this->{$name} = $value; // } // public function __get($name) { // //if (!property_exists($this, $name)) { // throw new Exception("No such property: $name"); // //} // //return $this->{$name}; // } } /* Declaring your struct/shape */ $person = new class() extends shapeClass { public $age = 15, $height = 72, $weight = 200; }; var_dump($person); var_dump($person->age); $person->age = 19; var_dump($person->age); try { var_dump($person->badProp); } catch (Exception $e) { var_dump($e); } try { $person->badProp = 5; } catch (Exception $e) { var_dump($e); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 22
Branch analysis from position: 22
2 jumps found. (Code = 107) Position 1 = 23, Position 2 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Found catch point at position: 29
Branch analysis from position: 29
2 jumps found. (Code = 107) Position 1 = 30, Position 2 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qjFa
function name:  (null)
number of ops:  34
compiled vars:  !0 = $person, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_ANON_CLASS                               <unknown> 'shapeclass'
          1        NEW                                              $3      $2
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   23     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   25     7        INIT_FCALL                                               'var_dump'
          8        FETCH_OBJ_R                                      ~7      !0, 'age'
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                                 
   26    11        ASSIGN_OBJ                                               !0, 'age'
         12        OP_DATA                                                  19
   27    13        INIT_FCALL                                               'var_dump'
         14        FETCH_OBJ_R                                      ~10     !0, 'age'
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                                 
   30    17        INIT_FCALL                                               'var_dump'
         18        FETCH_OBJ_R                                      ~12     !0, 'badProp'
         19        SEND_VAL                                                 ~12
         20        DO_ICALL                                                 
         21      > JMP                                                      ->26
   31    22  E > > CATCH                                       last         'Exception'
   32    23    >   INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   36    26    >   ASSIGN_OBJ                                               !0, 'badProp'
         27        OP_DATA                                                  5
         28      > JMP                                                      ->33
   37    29  E > > CATCH                                       last         'Exception'
   38    30    >   INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
   39    33    > > RETURN                                                   1

Class shapeClass: [no user functions]
Class shapeClass@anonymous: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.18 ms | 1396 KiB | 15 Q