Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104345 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91127 invoked from network); 11 Feb 2019 19:52:28 -0000 Received: from unknown (HELO mail-lj1-f179.google.com) (209.85.208.179) by pb1.pair.com with SMTP; 11 Feb 2019 19:52:28 -0000 Received: by mail-lj1-f179.google.com with SMTP id e17-v6so2409500lja.8 for ; Mon, 11 Feb 2019 08:35:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TC6uzd4/tSkOAV4z/vgPIWk/fO1YWbwe20bly8ftSRk=; b=T3NfT1omq0VRXGvQFumfDiWbeUYUbDmtdQUdmM0/B3VOFuGUmp78lRvTwqLHWQYPq7 0OPnD4NDBwGdxbb6147HFy96dsuXcfN3pDrE8JT8hk3ElDIcZyntbY5fVoEaVFGVFJ1h to7zWkR8bgAY5XXHpMEeiV77i2gAHdrm7KrBgq9Ij43+FjQotydROVv8deMj5TD3hr5r zE+KBclOLHQ+DqcFjry6YgwD2RoiykpyVxKf500pe8/uSohDvd9DzMi3fBfFJ6zLBsoe xPcXY7Bk2N9EM2w6Jfvzvv33afypA+4OdAJNYCSot7i0xeKsRVVL/zybsRCAFrXp1hML U/Vw== X-Gm-Message-State: AHQUAuYTraWqAWQ738Nrp22/qz5cWyoSH+s/RoUkdWM4+ITu5JCCKu8v AvpGTXp6dqgxdTKYhqYTygHRXsA+isVOtAePRV0= X-Google-Smtp-Source: AHgI3Ib+PxnImITiybNiLkUmSIXtSJZe+64IVacWlCqa/jw+thGRLd6ygS4iZzKcS0G2TUC4boMOVlXIRHLqamxbIBs= X-Received: by 2002:a2e:9a16:: with SMTP id o22-v6mr22587719lji.112.1549902907324; Mon, 11 Feb 2019 08:35:07 -0800 (PST) MIME-Version: 1.0 References: <5437a651-8263-49e9-b87e-d8d052d66c99@web.de> In-Reply-To: Date: Mon, 11 Feb 2019 09:34:49 -0700 Message-ID: To: Chase Peeler Cc: "Woortmann, Enno" , internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Variadic is_*() functions From: levim@php.net (Levi Morrison) >> I recognize that there is one downside, which is that lazy evaluation >> is lost, but generally don't see it to be an issue in these specific >> cases. >> > Lazy evaluation doesn't have to be lost if the all_of and any_of functions are written correctly. all_of will return false as soon as one of them fails, and any_of will return true as soon as one of them passes. > > Unless you are talking about cases like this: > if(is_numeric(reallyFastFunc($foo)) || is_numeric(reallySlowFunc($bar))) > In that case, you might be able to short circuit the evaluation of reallySlowFunc($bar), which wouldn't be the case with > if(any_of('is_numeric',reallyFastFunc($foo),reallySlowFunc($bar))){} Yes, this is what I was referring to. As previously stated, I don't think it's likely to be an issue. If it is, then as you stated the normal boolean logic can be used in such places. ----- In other words, nothing needs to be done in PHP itself. Just write or use someone else's `all_of`, `any_of`, `none_of`, etc, functions.