Re: PHP 7.1 - Address PHPSadness #28?

From: Date: Thu, 17 Sep 2015 13:09:38 +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-88283@lists.php.net to get a copy of this message
​Hi Rowan,​ On 17 September 2015 at 22:52, Rowan Collins <rowan.collins@gmail.com> wrote: > Terry Cullen wrote on 17/09/2015 13:41: > >> Here is an example where exists would be useful; >> > > You answered your own request: > > // I should have used property_exists() instead of isset().. wasn't >> expecting a null.. >> > > We already have that function, so that's alright then! :) > > As I've said several times, we need to improve documentation around this, > but "I didn't find the existing function, so I need a new function which > will be no easier to find and won't work in most people's environments" is > a pretty weak argument in favour of a language change. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > ​I agree that there is already ways around this issue, but I agree with Bob that there is a hole that exists() would fill. I my world where PHP is the glue between JSON requests and database queries, ​exists() would be a function I'd use way more the array_key_exists(), property_exists(), isset() and empty(). Further, in some scenarios exists($foo->bar) would replace isset($foo) && is_object($foo) && property_exists($foo, 'bar').

« previous php.internals (#88283) next »