Re: get_class behavior

From: Date: Fri, 29 Jan 2016 13:56:18 +0000
Subject: Re: get_class behavior
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-91013@lists.php.net to get a copy of this message
On 29 January 2016 at 10:46, Rowan Collins <rowan.collins@gmail.com> wrote: > > You appear to be suggesting that "get_class()" should behave differently > than "get_class(null)". > I don't know if internal parameter handling (ZPP) works like userland > parameters Regardless of how internals works, it's a thing in userland PHP. function foo($bar = null) { echo "number of args is: ".func_num_args(). "\n"; } foo(); foo(null); // Output is: // number of args is: 0 // number of args is: 1 It's a useful thing to do when you want to distinguish between null being passed, and the default value being used. Just like in this case. The same is possible for internal functions. cheers Dan

« previous php.internals (#91013) next »