Building variable getter-method
| From: | Michael Bakonyi | Date: | Thu, 29 May 2014 14:06:53 +0000 |
| Subject: | Building variable getter-method | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-323374@lists.php.net to get a copy of this message | ||
Hi,
I'd like to do something like this:
if (method_exists($object, 'get' . ucfirst($property))) {
$children = $object->{'get' . ucfirst($property)};
}
but this is not working unfortunately – $children is always NULL although the getter exits. Is there a another way to build a dynamic getter?
Cheers,
Michael