Benoit Schildknecht wrote on 18/09/2015 19:24:
I agree. exists() would allow PHP devs to make more secure, cleaner and lighter code. It fills a gap and would be useful to a lot of devs.

On the contrary, I think code using exists() would be extremely fragile, because it's highly resistant to refactoring, and encourages developers to leave variables uninitialised.

What makes cleaner, more secure code is always initialising your variables before using them - basically, what the "undefined variable" Notice is suggesting you do.

The examples Lester and Robert have come up with make sense in themselves, but are not architectures I would choose precisely because they are opaque (you have to remember what unset() and null mean) and hard to extend (there's no way to introduce a 4th state alongside the unset/null/value triad).

Obviously, all language features can be used to write bad code, but it seems much easier to write bad code than good using this proposed function.

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to