Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mauriciogofas/93c9c140c8235e29f1f976f5760585c6 to your computer and use it in GitHub Desktop.
Save mauriciogofas/93c9c140c8235e29f1f976f5760585c6 to your computer and use it in GitHub Desktop.
#php get protected property in objetc array
if(!function_exists('gib_get_protected_property')){
function gib_get_protected_property($object, $property){
$reflectedClass = new \ReflectionClass($object);
$reflection = $reflectedClass->getProperty($property);
$reflection->setAccessible(true);
return $reflection->getValue($object);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment