Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75219 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21880 invoked from network); 3 Jul 2014 11:35:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2014 11:35:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qc0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:49391] helo=mail-qc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6B/40-47713-B1045B35 for ; Thu, 03 Jul 2014 07:35:55 -0400 Received: by mail-qc0-f177.google.com with SMTP id r5so60237qcx.22 for ; Thu, 03 Jul 2014 04:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/Q53NCYTsuWwD2WaKS0rd4x4PgxlHwrvlJlsYJajfRU=; b=xbCY4npSoHnemuW0FDuu4vChX04piE5JZ6eBnTbiQAoOI5spquyb5l4KDQaxk7Luqo oa4JVTi1QW8REgGrBDPNXbc+Eu57+gvafmV41F5iJFApF1H5KfX3gYHLTgatDkGcd6IR 7GEJnv6pvGs8svdXJkxiDtWX1DbqX1P+GcUWzX+EbFEPbtDh4Emdx37KgzPEBRYifUT7 XCwTOP8qgx+o/mC6aJmXDUkH9bumrbm81UPYu288XxXGevISU2JNiPx0MdDdEdtim3M8 /fjmfNHPYdr0mNJJrYGPUY6+SP1xpCKnG7FtQqXWeGWl9QIN+tuoMjLjxghpBqVU3dcJ wZzQ== MIME-Version: 1.0 X-Received: by 10.224.29.144 with SMTP id q16mr6619115qac.18.1404387353027; Thu, 03 Jul 2014 04:35:53 -0700 (PDT) Received: by 10.140.28.183 with HTTP; Thu, 3 Jul 2014 04:35:52 -0700 (PDT) In-Reply-To: References: Date: Thu, 3 Jul 2014 13:35:52 +0200 Message-ID: To: Xen Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] not_null function From: pierre.php@gmail.com (Pierre Joye) hi, On Thu, Jul 3, 2014 at 11:40 AM, Xen wrote: > But a line like "if (!is_null($a))" feels like there are two verbs in it. > > It is like you are saying "if $a is not is null". > > It is different for the "empty" function because there is no "is_" prefix in > it. So "if (!empty($a)) feels completely sane. > > So generally I will *want* to test a null condition but I just hope my > variable won't contain anything that evaluates to false and just test "if > ($a)". that's why we have is_null, and NULL is a type, not a value btw. also isset is an operator, not a function. (referred in other replies). > If there was a not_null() I would use that instead, because "if > (not_null($a))" only contains one "verb" instead of two. > And I would define that helper function myself, but I don't want to write > code that another person would not be able to run just because not_null is > not defined in his library. is_null is consistent with the other is_* functions. A programming language is not a natural language so grammatical or semantic imperfections are totally valid. between the is_* functions, isset or ?:, I do not see a need to add the exact same features for a non technical reason. Cheers, -- Pierre @pierrejoye | http://www.libgd.org