3v4l.org

run code in 500+ PHP versions simultaneously
<?php class UserModel { protected const DEFAULT_ALLOWED_FIELDS = [ 'username', 'status', 'status_message', 'active', 'last_active', 'deleted_at', ]; // ... other properties protected $allowedFields = self::DEFAULT_ALLOWED_FIELDS; // ... other properties } class MyModel extends UserModel { protected $allowedFields = [ ...self::DEFAULT_ALLOWED_FIELDS, 'phone_number', 'tax_id', ]; } $model = new MyModel(); $property = new ReflectionProperty($model, 'allowedFields'); $property->setAccessible(true); var_dump($property->getValue($model));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I84pS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $model, !1 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   NEW                                                  $2      'MyModel'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   29     3        NEW                                                  $5      'ReflectionProperty'
          4        SEND_VAR_EX                                                  !0
          5        SEND_VAL_EX                                                  'allowedFields'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $5
   30     8        INIT_METHOD_CALL                                             !1, 'setAccessible'
          9        SEND_VAL_EX                                                  <true>
         10        DO_FCALL                                          0          
   32    11        INIT_FCALL                                                   'var_dump'
         12        INIT_METHOD_CALL                                             !1, 'getValue'
         13        SEND_VAR_EX                                                  !0
         14        DO_FCALL                                          0  $9      
         15        SEND_VAR                                                     $9
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Class UserModel: [no user functions]
Class MyModel: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.9 ms | 1931 KiB | 14 Q