Skip to content

Instantly share code, notes, and snippets.

@marcelaraujo
Created February 5, 2015 00:45
Show Gist options
  • Select an option

  • Save marcelaraujo/89e6a355b5aa7ed524b8 to your computer and use it in GitHub Desktop.

Select an option

Save marcelaraujo/89e6a355b5aa7ed524b8 to your computer and use it in GitHub Desktop.
Reading private properties
$reader = function($object, $property) {
$value = \Closure::bind(function() use($property) {
return $this->$property;
}, $object, $object)->__invoke();
return $value;
};
print_r( $reader($this, 'created') );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment