Skip to content

Instantly share code, notes, and snippets.

@mikemadisonweb
Created July 23, 2016 06:11
Show Gist options
  • Save mikemadisonweb/e414a226433951c98e06c485b64dcc1d to your computer and use it in GitHub Desktop.
Save mikemadisonweb/e414a226433951c98e06c485b64dcc1d to your computer and use it in GitHub Desktop.
<?php
// Return array with proper private and protected property names
function dismount($object) {
$reflectionClass = new ReflectionClass(get_class($object));
$array = array();
foreach ($reflectionClass->getProperties() as $property) {
$property->setAccessible(true);
$array[$property->getName()] = $property->getValue($object);
$property->setAccessible(false);
}
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment