Created
July 23, 2016 06:11
-
-
Save mikemadisonweb/e414a226433951c98e06c485b64dcc1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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