Re: Detecting if a null variable exists?
| From: | Christian Schneider | Date: | Mon, 14 Jun 2010 12:08:53 +0000 |
| Subject: | Re: Detecting if a null variable exists? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-48773@lists.php.net to get a copy of this message | ||
Frederic Hardy wrote:
>> I however have never seen a proper usecase..
>
> class foo {
> public function __call($method, $arguments)
> {
> // We MUST have at least ONE argument !
> if (array_key_exists(0, $arguments) === false) //
> isset($arguments[0]) return false if first argument has null value
Why not simply
if (count($arguments) == 0)
..
which is simpler and clearer?
I agree with Hannes that most "usecases" should be solved differently
anyway.
- Chris