Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47514 invoked from network); 28 Apr 2012 22:43:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2012 22:43:49 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:48088] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/28-06766-4A27C9F4 for ; Sat, 28 Apr 2012 18:43:49 -0400 Received: by lbgc1 with SMTP id c1so296576lbg.29 for ; Sat, 28 Apr 2012 15:43:45 -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=mKQyc7HtyXVv4MehY9s5aNciCBQ7U9ngE3zjPBnf+us=; b=c28Rmwojgf9nJEK0fOV6CtMCxm/4P38xqcU3RNw0YvjLG+qugwGqAMhcAkrzXhnTrJ K0gxw48jUHsmdR6+Gjo9xq9SxRw+bE525uQRBI/oRv1ZtMyGVIj4Lur3r7RS5yPnGlms wt9esLS6bSdT35kz5zwNAVbXM2aAJoQGxkOBXSxrxIzdlaD3d5j1bNsAcx22qeJ7HmBB kGOWxwk+Od4Ghhx5hqSOf85OvueT+aPQCcDXHc7yqdIwMmp+Se3S6BXAdxS6EQ4myO12 Gzp+RkvLW++k36yyx5KAUXjJM3ER8JnWhgBfZ5DBB7kT8W30sN3YiBdsgBvSzMvRibhH syoA== MIME-Version: 1.0 Received: by 10.152.104.80 with SMTP id gc16mr15385988lab.46.1335653025825; Sat, 28 Apr 2012 15:43:45 -0700 (PDT) Received: by 10.112.100.227 with HTTP; Sat, 28 Apr 2012 15:43:45 -0700 (PDT) In-Reply-To: <4F9C32E4.7020108@googlemail.com> References: <4F9AFE3D.8010805@quis.cx> <4F9C32E4.7020108@googlemail.com> Date: Sat, 28 Apr 2012 18:43:45 -0400 Message-ID: To: Sebastian Krebs Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Function boolval() From: theanomaly.is@gmail.com (Sherif Ramadan) > > $bools = array_map(function($a){ return((boolean) $a); }, range('a', 'z')); > $bools = array_map('boolval', range('a', 'z')); > > Second one seems more readable to me... > > Sorry, I forget to hit reply-all sometimes... So lets try that again... Why is this going to be more beneficial to implement? Is it that you feel readability of the closure is too difficult or that you feel there is a use case that presents further benefits for implementing a boolval function, beyond that of just readability or other subjective preferences? Personally, I would feel something like array_filter(range('a','z')); is way more readable than all of the above and makes a lot more sense to me. Under most circumstances, one does not tend to care about the truth in expression unless it is truth. So the following code is far more practical than the suggestions being made here: if (!array_filter(array(0,false,null,'', array()))) { /* The array is made up entirely of falsey values */ } else { /* The array is not made up entirely of falsey values */ } I'm not saying the function is useless. I'm just saying PHP already offers more than 1,000 functions through core, alone, and adding just one more function that doesn't seem to offer anything new really isn't sounding like a promising idea to me. We only add to people's confusion more by offering them dozens of choices to accomplish the same thing. We've all heard the arguments of "print vs. echo", or X vs Y. There's no practical reason to include this in core being presented hear apart from "I like it more..."