Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87923 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3304 invoked from network); 26 Aug 2015 03:33:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Aug 2015 03:33:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:37997] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/52-23604-F833DD55 for ; Tue, 25 Aug 2015 23:33:35 -0400 Received: by wicja10 with SMTP id ja10so2523201wic.1 for ; Tue, 25 Aug 2015 20:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=qBteuEoaAwjYV7qdGFCApT/AoqIkVHNeVF44zSHv3LM=; b=GYKFglul5W8RQFBZefSUrse/SO587+LZr3Voo6+PfkA/8ASb15x95/cVHC3+effd0q 8utWq6Omg/JJGfdJlg8bAihSeu+Im39OEguOzvIsfyNGPkKH/uzeAo0PUJK4LrrwGUQA Zn1CPYAxAVwVCVT3eQyl232At1ZlyXWNPwJqhxw+mN4Bf6qBGKXVZVAcYfjThlLnWm1w 38weK0dbP8PilMtvIK5Nh6cIEWPfrnPKwjqhkO9eGo/pp+Q0NzpgwvTZrVd6wBuwmO2w P05S4Nid75vKORcCKwy7fQaVCwCBII3Pmg82A/iSJG/t76oYcsmCRdLFQergoPQWMYCk opNQ== X-Received: by 10.180.87.230 with SMTP id bb6mr795948wib.26.1440560012671; Tue, 25 Aug 2015 20:33:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.31.134 with HTTP; Tue, 25 Aug 2015 20:33:13 -0700 (PDT) In-Reply-To: References: Date: Wed, 26 Aug 2015 04:33:13 +0100 Message-ID: To: Sherif Ramadan Cc: Scott Arciszewski , PHP Internals Content-Type: multipart/alternative; boundary=f46d0444e97bd54041051e2e830a Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: ocramius@gmail.com (Marco Pivetta) --f46d0444e97bd54041051e2e830a Content-Type: text/plain; charset=UTF-8 You are probably looking for something like `array_key_exists($varName, get_defined_vars());`: https://3v4l.org/XagEA Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 26 August 2015 at 04:26, Sherif Ramadan wrote: > I get that it exists. I'm asking what is the usefulness of having a > function that tells you the variable is null? In theory this sounds great > and is actually very doable by checking the symbol table for the hash. > However, in practice, who actually has a use for this? Null is a special > value in PHP, so if you're assigning it to a variable explicitly you should > already know you've initialized that variable and can safely rely on if ($x > === null) in your code. > > I'm not confused about the differences. I'm questioning the usefulness of > such a function. > > On Tue, Aug 25, 2015 at 11:18 PM, Scott Arciszewski > wrote: > > > Because $x exists. > > > > https://3v4l.org/kUJtP > > Scott Arciszewski > > Chief Development Officer > > Paragon Initiative Enterprises > > > > > > On Tue, Aug 25, 2015 at 11:16 PM, Sherif Ramadan > > wrote: > > > Yes, because all undefined variables in PHP are implicitly null. As far > > as > > > PHP is concerned, if it's null, it's by definition _not defined_. Also, > > > still not seeing where a NOTICE is involved here? Those functions never > > give > > > errors. > > > > > > What is the usefulness of a function that merely returns true when a > > > variable is null? > > > > > > On Tue, Aug 25, 2015 at 11:13 PM, Scott Arciszewski < > scott@paragonie.com > > > > > > wrote: > > >> > > >> On Tue, Aug 25, 2015 at 11:11 PM, Sherif Ramadan > > >> wrote: > > >> > That's exactly what isset() does. isset/empty never raise errors. > > >> > > > >> > On Tue, Aug 25, 2015 at 11:09 PM, Scott Arciszewski > > >> > > > >> > wrote: > > >> >> > > >> >> Hi everybody, > > >> >> > > >> >> Would anyone be interested in adding another helper like > > >> >> isset()/empty() simply called exists() which would return true if > the > > >> >> variable is defined in the current scope (i.e. without raising an > > >> >> E_NOTICE)? > > >> >> > > >> >> It should be a simple change to add this function but it's too late > > >> >> for 7.0 so, if there is any interest, I would respectfully put it > off > > >> >> until 7.1. > > >> >> > > >> >> Scott Arciszewski > > >> >> Chief Development Officer > > >> >> Paragon Initiative Enterprises > > >> >> > > >> >> -- > > >> >> PHP Internals - PHP Runtime Development Mailing List > > >> >> To unsubscribe, visit: http://www.php.net/unsub.php > > >> >> > > >> > > > >> http://phpsadness.com/sad/28 > > >> https://3v4l.org/2vrKG > > >> > > >> Not quite. > > >> > > >> Scott Arciszewski > > >> Chief Development Officer > > >> Paragon Initiative Enterprises > > > > > > > > > --f46d0444e97bd54041051e2e830a--