Using Reflection to access protected properties in PHP

Mon Apr 15 2019 02:00:00 GMT+0000 (Coordinated Universal Time)

Here is how to access protected class properties. Reflection is generally a method for inspecting classes and modify its logic at execution time.

<?php
$class = new ReflectionClass($classInstance);
$property = $class->getProperty("properties");
$property->setAccessible(true);
$properties = $property->getValue($number);