Re: get_class behavior
| From: | Rowan Collins | Date: | Fri, 29 Jan 2016 10:46:15 +0000 |
| Subject: | Re: get_class behavior | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91010@lists.php.net to get a copy of this message | ||
Dan Ackroyd wrote on 28/01/2016 22:35:
## Refactoring if non-objects are no longer allowed. Current code: echo get_class($result); Would need to be changed to: if ($result === null) {You appear to be suggesting that "get_class()" should behave differently than "get_class(null)". Normally a function doesn't distinguish between "called with no parameters" and "called with default parameters". I don't know if internal parameter handling (ZPP) works like userland parameters in this respect, but if not impossible this would at least be rather surprising. It also doesn't help with your stated point of using get_class as a callable, since you'd have to know what function it was in order to call it in the right way (although exactly what the use case for that would be, I've no idea). Regards, Rowan Collins -- [IMSoP]echo get_class();} else { echo get_class($result); }