3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Strategy for converting a dynamic property that is initialized only when the property is invoked. * * This strategy declares the property but sets its visibility to private. By setting it to * private (opr protected), the original intent still works, meaning it's only init and set when * code invokes it (which invokes the __get()). */ class DynamicPropInitOnGet { public $prop1; public $prop2; public $prop3; private $known; public function __construct( $props ) { foreach ( $props as $prop => $value ) { $this->$prop = $value; } } public function __get( $prop ) { if ( 'known' !== $prop ) { trigger_error( sprintf( 'Getting the dynamic property "%s" on %s is deprecated', $prop, __CLASS__ ), E_USER_DEPRECATED ); return null; } $this->known = new stdClass(); foreach ( array( 'prop1', 'prop2' ) as $column ) { $this->known->{$column} = isset( $this->{$column} ) ? $this->{$column} : null; } return $this->known; } public function __isset( $prop ) { if ( 'known' === $prop ) { return isset( $this->known ); } return false; } public function __set( $prop, $value ) { if ( 'known' === $prop ) { $this->known = $value; return; } trigger_error( sprintf( 'Setting the dynamic property "%s" on %s is deprecated', $prop, __CLASS__ ), E_USER_DEPRECATED ); } public function __unset( $prop ) { if ( 'known' === $prop ) { unset( $this->known ); return; } trigger_error( sprintf( 'Unsetting the dynamic property "%s" on %s is deprecated', $prop, __CLASS__ ), E_USER_DEPRECATED ); } } class TestMagicMethods { private $obj; private $is_known_prop = false; public function __construct( $obj ) { $this->obj = $obj; } public function test( $prop ) { $this->is_known_prop = ( 'known' === $prop ); // __isset. $this->test_isset( $prop ); // __get(). $this->test_get( $prop ); // __isset() after __get(). $this->test_isset( $prop, true ); // __unset(). $this->test_unset( $prop ); } private function test_isset( $prop, $after_get = false ) { $actual = isset( $this->obj->$prop ); if ( ! $after_get ) { printf( "__isset() results should be false %s\n", $this->test_results( false === $actual ) ); } else { $expected = $this->is_known_prop; printf( "\n\n__isset() after __get() results should be %s %s\n", $this->is_known_prop ? 'true' : 'false', $this->test_results( $expected == $actual ) ); } var_dump( $actual ); } private function test_get( $prop ) { $actual = $this->obj->$prop; $message = "\n\n__get() results should be %s %s\n"; if ( $this->is_known_prop ) { printf( $message, 'an object with prop1 and prop2', $this->test_results( $actual instanceof stdClass ) ); } else { printf( $message, 'null', $this->test_results( null === $actual ) ); } var_dump( $actual ); } private function test_set( $prop ) { $value = $this->is_known_prop ? (array) $this->$obj->known : 'I am an unknown dynamic property'; $obj->$prop = $value; $actual = $this->obj->$prop; if ( $this->is_known_prop ) { printf( "\n\n" . '__set() results should set the value %s and not throw a deprecation on PHP 8.2+.' . 'However, once the __get() is called again, it will set reset it to an object with prop1 and prop2.' . "\n", $this->test_results( $actual instanceof stdClass ) ); } else { printf( "\n\n" . '__set() results should set the value %s and not throw a deprecation on PHP 8.2+.' . 'The set value should remain set when invoking __get()' . "\n", $this->test_results( $value === $actual ) ); } var_dump( $actual ); } private function test_unset( $prop ) {// unset. unset( $this->obj->$prop ); $actual = $this->obj->$prop; $message = "\n\n__unset() + __get() results should be %s %s\n"; if ( $this->is_known_prop ) { printf( $message, 're-init the object with prop1 and prop2', $this->test_results( $actual instanceof stdClass ) ); } else { printf( $message, 'null', $this->test_results( null === $actual ) ); } var_dump( $actual ); } private function test_results( $actual ) { return $actual ? '✅' : '❌'; } } $obj = new DynamicPropInitOnGet( array( 'prop1' => 'foo', 'prop2' => 'bar', 'prop3' => 'baz', ) ); $tester = new TestMagicMethods( $obj ); echo "***** Test the 'known' property *****\n\n"; $tester->test( 'known' ); echo "\n\n***** Unknown, unexpected dynamic property *****\n\n"; $tester->test( 'unknown' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  (null)
number of ops:  17
compiled vars:  !0 = $obj, !1 = $tester
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  179     0  E >   NEW                                              $2      'DynamicPropInitOnGet'
  181     1        SEND_VAL_EX                                              <array>
  179     2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
  187     4        NEW                                              $5      'TestMagicMethods'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
  189     8        ECHO                                                     '%2A%2A%2A%2A%2A+Test+the+%27known%27+property+%2A%2A%2A%2A%2A%0A%0A'
  190     9        INIT_METHOD_CALL                                         !1, 'test'
         10        SEND_VAL_EX                                              'known'
         11        DO_FCALL                                      0          
  192    12        ECHO                                                     '%0A%0A%2A%2A%2A%2A%2A+Unknown%2C+unexpected+dynamic+property+%2A%2A%2A%2A%2A%0A%0A'
  193    13        INIT_METHOD_CALL                                         !1, 'test'
         14        SEND_VAL_EX                                              'unknown'
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Class DynamicPropInitOnGet:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/6gXXU
function name:  __construct
number of ops:  9
compiled vars:  !0 = $props, !1 = $value, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1      > FE_RESET_R                                       $3      !0, ->7
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->7
          3    >   ASSIGN                                                   !2, ~4
   19     4        ASSIGN_OBJ                                               !2
          5        OP_DATA                                                  !1
   18     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $3
   21     8      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 29
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/6gXXU
function name:  __get
number of ops:  33
compiled vars:  !0 = $prop, !1 = $column
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        IS_NOT_IDENTICAL                                         !0, 'known'
          2      > JMPZ                                                     ~2, ->13
   25     3    >   INIT_FCALL                                               'trigger_error'
   26     4        INIT_FCALL                                               'sprintf'
          5        SEND_VAL                                                 'Getting+the+dynamic+property+%22%25s%22+on+%25s+is+deprecated'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'DynamicPropInitOnGet'
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
   27    10        SEND_VAL                                                 16384
   25    11        DO_ICALL                                                 
   29    12      > RETURN                                                   null
   32    13    >   NEW                                              $6      'stdClass'
         14        DO_FCALL                                      0          
         15        ASSIGN_OBJ                                               'known'
         16        OP_DATA                                                  $6
   33    17      > FE_RESET_R                                       $8      <array>, ->29
         18    > > FE_FETCH_R                                               $8, !1, ->29
   34    19    >   ISSET_ISEMPTY_PROP_OBJ                                   !1
         20      > JMPZ                                                     ~11, ->24
         21    >   FETCH_OBJ_R                                      ~12     !1
         22        QM_ASSIGN                                        ~13     ~12
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~13     null
         25    >   FETCH_OBJ_W                                      $9      'known'
         26        ASSIGN_OBJ                                               $9, !1
         27        OP_DATA                                                  ~13
   33    28      > JMP                                                      ->18
         29    >   FE_FREE                                                  $8
   37    30        FETCH_OBJ_R                                      ~14     'known'
         31      > RETURN                                                   ~14
   38    32*     > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  __isset
number of ops:  7
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   41     1        IS_IDENTICAL                                             !0, 'known'
          2      > JMPZ                                                     ~1, ->5
   42     3    >   ISSET_ISEMPTY_PROP_OBJ                           ~2      'known'
          4      > RETURN                                                   ~2
   45     5    > > RETURN                                                   <false>
   46     6*     > RETURN                                                   null

End of function __isset

Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  __set
number of ops:  17
compiled vars:  !0 = $prop, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   49     2        IS_IDENTICAL                                             !0, 'known'
          3      > JMPZ                                                     ~2, ->7
   50     4    >   ASSIGN_OBJ                                               'known'
          5        OP_DATA                                                  !1
   51     6      > RETURN                                                   null
   54     7    >   INIT_FCALL                                               'trigger_error'
   55     8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 'Setting+the+dynamic+property+%22%25s%22+on+%25s+is+deprecated'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'DynamicPropInitOnGet'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
   56    14        SEND_VAL                                                 16384
   54    15        DO_ICALL                                                 
   58    16      > RETURN                                                   null

End of function __set

Function __unset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  __unset
number of ops:  15
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV                                             !0      
   61     1        IS_IDENTICAL                                             !0, 'known'
          2      > JMPZ                                                     ~1, ->5
   62     3    >   UNSET_OBJ                                                'known'
   63     4      > RETURN                                                   null
   66     5    >   INIT_FCALL                                               'trigger_error'
   67     6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 'Unsetting+the+dynamic+property+%22%25s%22+on+%25s+is+deprecated'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'DynamicPropInitOnGet'
         10        DO_ICALL                                         $2      
         11        SEND_VAR                                                 $2
   68    12        SEND_VAL                                                 16384
   66    13        DO_ICALL                                                 
   70    14      > RETURN                                                   null

End of function __unset

End of class DynamicPropInitOnGet.

Class TestMagicMethods:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  __construct
number of ops:  4
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   77     0  E >   RECV                                             !0      
   78     1        ASSIGN_OBJ                                               'obj'
          2        OP_DATA                                                  !0
   79     3      > RETURN                                                   null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  test
number of ops:  18
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   81     0  E >   RECV                                             !0      
   82     1        IS_IDENTICAL                                     ~2      !0, 'known'
          2        ASSIGN_OBJ                                               'is_known_prop'
          3        OP_DATA                                                  ~2
   86     4        INIT_METHOD_CALL                                         'test_isset'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   89     7        INIT_METHOD_CALL                                         'test_get'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   92    10        INIT_METHOD_CALL                                         'test_isset'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   95    14        INIT_METHOD_CALL                                         'test_unset'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0          
   96    17      > RETURN                                                   null

End of function test

Function test_isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  test_isset
number of ops:  36
compiled vars:  !0 = $prop, !1 = $after_get, !2 = $actual, !3 = $expected
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   98     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   99     2        FETCH_OBJ_IS                                     ~4      'obj'
          3        ISSET_ISEMPTY_PROP_OBJ                           ~5      ~4, !0
          4        ASSIGN                                                   !2, ~5
  101     5        BOOL_NOT                                         ~7      !1
          6      > JMPZ                                                     ~7, ->16
  102     7    >   INIT_FCALL                                               'printf'
          8        SEND_VAL                                                 '__isset%28%29+results+should+be+false+%25s%0A'
          9        INIT_METHOD_CALL                                         'test_results'
         10        TYPE_CHECK                                    4  ~8      !2
         11        SEND_VAL_EX                                              ~8
         12        DO_FCALL                                      0  $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                                 
  101    15      > JMP                                                      ->32
  104    16    >   FETCH_OBJ_R                                      ~11     'is_known_prop'
         17        ASSIGN                                                   !3, ~11
  105    18        INIT_FCALL                                               'printf'
  106    19        SEND_VAL                                                 '%0A%0A__isset%28%29+after+__get%28%29+results+should+be+%25s+%25s%0A'
  107    20        FETCH_OBJ_R                                      ~13     'is_known_prop'
         21      > JMPZ                                                     ~13, ->24
         22    >   QM_ASSIGN                                        ~14     'true'
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~14     'false'
         25    >   SEND_VAL                                                 ~14
  108    26        INIT_METHOD_CALL                                         'test_results'
         27        IS_EQUAL                                         ~15     !3, !2
         28        SEND_VAL_EX                                              ~15
         29        DO_FCALL                                      0  $16     
         30        SEND_VAR                                                 $16
  105    31        DO_ICALL                                                 
  112    32    >   INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
  113    35      > RETURN                                                   null

End of function test_isset

Function test_get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  test_get
number of ops:  30
compiled vars:  !0 = $prop, !1 = $actual, !2 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  115     0  E >   RECV                                             !0      
  116     1        FETCH_OBJ_R                                      ~3      'obj'
          2        FETCH_OBJ_R                                      ~4      ~3, !0
          3        ASSIGN                                                   !1, ~4
  117     4        ASSIGN                                                   !2, '%0A%0A__get%28%29+results+should+be+%25s+%25s%0A'
  118     5        FETCH_OBJ_R                                      ~7      'is_known_prop'
          6      > JMPZ                                                     ~7, ->17
  119     7    >   INIT_FCALL                                               'printf'
          8        SEND_VAR                                                 !2
          9        SEND_VAL                                                 'an+object+with+prop1+and+prop2'
         10        INIT_METHOD_CALL                                         'test_results'
         11        INSTANCEOF                                       ~8      !1, 'stdClass'
         12        SEND_VAL_EX                                              ~8
         13        DO_FCALL                                      0  $9      
         14        SEND_VAR                                                 $9
         15        DO_ICALL                                                 
  118    16      > JMP                                                      ->26
  121    17    >   INIT_FCALL                                               'printf'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 'null'
         20        INIT_METHOD_CALL                                         'test_results'
         21        TYPE_CHECK                                    2  ~11     !1
         22        SEND_VAL_EX                                              ~11
         23        DO_FCALL                                      0  $12     
         24        SEND_VAR                                                 $12
         25        DO_ICALL                                                 
  124    26    >   INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
  125    29      > RETURN                                                   null

End of function test_get

Function test_set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
Branch analysis from position: 26
filename:       /in/6gXXU
function name:  test_set
number of ops:  38
compiled vars:  !0 = $prop, !1 = $value, !2 = $obj, !3 = $actual
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  127     0  E >   RECV                                             !0      
  128     1        FETCH_OBJ_R                                      ~4      'is_known_prop'
          2      > JMPZ                                                     ~4, ->8
          3    >   FETCH_OBJ_R                                      ~5      !2
          4        FETCH_OBJ_R                                      ~6      ~5, 'known'
          5        CAST                                          7  ~7      ~6
          6        QM_ASSIGN                                        ~8      ~7
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~8      'I+am+an+unknown+dynamic+property'
          9    >   ASSIGN                                                   !1, ~8
  129    10        ASSIGN_OBJ                                               !2, !0
         11        OP_DATA                                                  !1
  130    12        FETCH_OBJ_R                                      ~11     'obj'
         13        FETCH_OBJ_R                                      ~12     ~11, !0
         14        ASSIGN                                                   !3, ~12
  132    15        FETCH_OBJ_R                                      ~14     'is_known_prop'
         16      > JMPZ                                                     ~14, ->26
  133    17    >   INIT_FCALL                                               'printf'
  137    18        SEND_VAL                                                 '%0A%0A__set%28%29+results+should+set+the+value+%25s+and+not+throw+a+deprecation+on+PHP+8.2%2B.However%2C+once+the+__get%28%29+is+called+again%2C+it+will+set+reset+it+to+an+object+with+prop1+and+prop2.%0A'
  138    19        INIT_METHOD_CALL                                         'test_results'
         20        INSTANCEOF                                       ~15     !3, 'stdClass'
         21        SEND_VAL_EX                                              ~15
         22        DO_FCALL                                      0  $16     
         23        SEND_VAR                                                 $16
  133    24        DO_ICALL                                                 
  132    25      > JMP                                                      ->34
  141    26    >   INIT_FCALL                                               'printf'
  145    27        SEND_VAL                                                 '%0A%0A__set%28%29+results+should+set+the+value+%25s+and+not+throw+a+deprecation+on+PHP+8.2%2B.The+set+value+should+remain+set+when+invoking+__get%28%29%0A'
  146    28        INIT_METHOD_CALL                                         'test_results'
         29        IS_IDENTICAL                                     ~18     !1, !3
         30        SEND_VAL_EX                                              ~18
         31        DO_FCALL                                      0  $19     
         32        SEND_VAR                                                 $19
  141    33        DO_ICALL                                                 
  150    34    >   INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                                 
  151    37      > RETURN                                                   null

End of function test_set

Function test_unset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  test_unset
number of ops:  32
compiled vars:  !0 = $prop, !1 = $actual, !2 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  153     0  E >   RECV                                             !0      
  154     1        FETCH_OBJ_UNSET                                  $3      'obj'
          2        UNSET_OBJ                                                $3, !0
  155     3        FETCH_OBJ_R                                      ~4      'obj'
          4        FETCH_OBJ_R                                      ~5      ~4, !0
          5        ASSIGN                                                   !1, ~5
  157     6        ASSIGN                                                   !2, '%0A%0A__unset%28%29+%2B+__get%28%29+results+should+be+%25s+%25s%0A'
  158     7        FETCH_OBJ_R                                      ~8      'is_known_prop'
          8      > JMPZ                                                     ~8, ->19
  159     9    >   INIT_FCALL                                               'printf'
  160    10        SEND_VAR                                                 !2
  161    11        SEND_VAL                                                 're-init+the+object+with+prop1+and+prop2'
  162    12        INIT_METHOD_CALL                                         'test_results'
         13        INSTANCEOF                                       ~9      !1, 'stdClass'
         14        SEND_VAL_EX                                              ~9
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
  159    17        DO_ICALL                                                 
  158    18      > JMP                                                      ->28
  165    19    >   INIT_FCALL                                               'printf'
  166    20        SEND_VAR                                                 !2
  167    21        SEND_VAL                                                 'null'
  168    22        INIT_METHOD_CALL                                         'test_results'
         23        TYPE_CHECK                                    2  ~12     !1
         24        SEND_VAL_EX                                              ~12
         25        DO_FCALL                                      0  $13     
         26        SEND_VAR                                                 $13
  165    27        DO_ICALL                                                 
  171    28    >   INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
  172    31      > RETURN                                                   null

End of function test_unset

Function test_results:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gXXU
function name:  test_results
number of ops:  7
compiled vars:  !0 = $actual
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  174     0  E >   RECV                                             !0      
  175     1      > JMPZ                                                     !0, ->4
          2    >   QM_ASSIGN                                        ~1      '%E2%9C%85'
          3      > JMP                                                      ->5
          4    >   QM_ASSIGN                                        ~1      '%E2%9D%8C'
          5    > > RETURN                                                   ~1
  176     6*     > RETURN                                                   null

End of function test_results

End of class TestMagicMethods.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.28 ms | 1491 KiB | 17 Q