Re: PHP 7.1 - Address PHPSadness #28?
| From: | Rowan Collins | Date: | Sat, 19 Sep 2015 12:25:31 +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-88373@lists.php.net to get a copy of this message | ||
On 19 September 2015 00:04:46 BST, "François Laupretre" <francois@php.net> wrote:
>So, as everyone seems to have exposed his arguments, I think we need an
>RFC and a patch now. Unless anyone volunteers, I'll write the patch.
>Who
>can write the RFC ? Robert ?
I may have given the impression of stubbornness in this discussion, but I have listened to
people's arguments, and am considering an RFC proposing two functions:
- a syntactic sugar for array_key_exists and property_exists, maybe called hasitem();
hasitem($foo['bar']) would check $foo has the item 'bar', but hasitem($foo)
would be an error
- a function for checking if a variable is in the current symbol table, maybe called variable_exists
to match class_exists etc; it would take a string naming the variable, e.g.
variable_exists('foo'); I am worried that this will be abused, and tempted to give it a
"scarier" name
Importantly, neither of these should be presented as "fixing isset", since I have seen
absolutely zero evidence that it is broken; the names and behaviours are designed to highlight that
these are functions to be used for specific purposes.
Regards,
--
Rowan Collins
[IMSoP]