Re: Building variable getter-method
| From: | Tsvetan Nikolov | Date: | Thu, 29 May 2014 15:13:12 +0000 |
| Subject: | Re: Building variable getter-method | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323375@lists.php.net to get a copy of this message | ||
make sure your getter class returns something!
On Thu, May 29, 2014 at 4:06 PM, Michael Bakonyi <kontakt@mb-neuemedien.de>
wrote:
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>