3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __set($key, $value) { trigger_error("Class uses undeclared property: " . __CLASS__ . "->" . $key, E_USER_WARNING); $this->{$key} = $value; } public function usesDynamicProp() { $this->undeclaredProp = "test value"; } public function getsDynamicProp() { var_dump($this->undeclaredProp); } } $o = new Test(); $o->usesDynamicProp(); $o->getsDynamicProp(); // Subsequent calls do not trigger the warning because the property exists, so it will only occur once per script execution $o->usesDynamicProp();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SgUUG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'usesDynamicProp'
          4        DO_FCALL                                      0          
   27     5        INIT_METHOD_CALL                                         !0, 'getsDynamicProp'
          6        DO_FCALL                                      0          
   29     7        INIT_METHOD_CALL                                         !0, 'usesDynamicProp'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class Test:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SgUUG
function name:  __set
number of ops:  10
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'trigger_error'
          3        CONCAT                                           ~2      'Class+uses+undeclared+property%3A+Test-%3E', !0
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 512
          6        DO_ICALL                                                 
    9     7        ASSIGN_OBJ                                               !0
          8        OP_DATA                                                  !1
   10     9      > RETURN                                                   null

End of function __set

Function usesdynamicprop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SgUUG
function name:  usesDynamicProp
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN_OBJ                                               'undeclaredProp'
          1        OP_DATA                                                  'test+value'
   16     2      > RETURN                                                   null

End of function usesdynamicprop

Function getsdynamicprop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SgUUG
function name:  getsDynamicProp
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'undeclaredProp'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   22     4      > RETURN                                                   null

End of function getsdynamicprop

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.82 ms | 1015 KiB | 15 Q