Re: PHP 7.1 - Address PHPSadness #28?
| From: | Rowan Collins | Date: | Tue, 22 Sep 2015 10:49:12 +0000 |
| Subject: | Re: PHP 7.1 - Address PHPSadness #28? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88403@lists.php.net to get a copy of this message | ||
François Laupretre wrote on 22/09/2015 01:11:
Hi, for those interested, a pull request implementing an exists() construct (on PHP 7) is available for testing and reviewing : https://github.com/php/php-src/pull/1530 exists() is modelled after isset(), with the difference that every value (including null) returns true. Check the included '.phpt' test file for examples.I take it you didn't like my suggestion of separate functions for hasitem() and variable_exists() then? I think there are two very different use cases here, and combining them will just add to the confusion which isset() already seems to cause. A variable_exists() which took a string (in keeping with class_exists(), function_exists(), etc) would also be more powerful, since you could write things like variable_exists('foo_' . $i) Regards, -- Rowan Collins [IMSoP]