3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; public function change_treat() { $this->yummy = 'pie'; } } class pantry extends Kitchen { public function FindFood() { $prop = (new \ReflectionObject($this))->getParentClass()->getProperty('yummy'); $prop->setAccessible(true); echo "Look, a " . $prop->getValue() . "!\n"; } } $p = new pantry(); $p->FindFood(); $p->change_treat(); $p->FindFood();

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IAu0R
function name:  (null)
number of ops:  10
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'pantry'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'FindFood'
          4        DO_FCALL                                      0          
   27     5        INIT_METHOD_CALL                                         !0, 'change_treat'
          6        DO_FCALL                                      0          
   28     7        INIT_METHOD_CALL                                         !0, 'FindFood'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class Kitchen:
Function change_treat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IAu0R
function name:  change_treat
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'yummy'
          1        OP_DATA                                                  'pie'
   10     2      > RETURN                                                   null

End of function change_treat

End of class Kitchen.

Class pantry:
Function findfood:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IAu0R
function name:  FindFood
number of ops:  19
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'ReflectionObject'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'getParentClass'
          5        DO_FCALL                                      0  $4      
          6        INIT_METHOD_CALL                                         $4, 'getProperty'
          7        SEND_VAL_EX                                              'yummy'
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !0, $5
   20    10        INIT_METHOD_CALL                                         !0, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   21    13        INIT_METHOD_CALL                                         !0, 'getValue'
         14        DO_FCALL                                      0  $8      
         15        CONCAT                                           ~9      'Look%2C+a+', $8
         16        CONCAT                                           ~10     ~9, '%21%0A'
         17        ECHO                                                     ~10
   22    18      > RETURN                                                   null

End of function findfood

Function change_treat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IAu0R
function name:  change_treat
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'yummy'
          1        OP_DATA                                                  'pie'
   10     2      > RETURN                                                   null

End of function change_treat

End of class pantry.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.04 ms | 1399 KiB | 13 Q