Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91122 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73446 invoked from network); 8 Feb 2016 16:40:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2016 16:40:14 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.52 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:37423] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/85-36326-BE4C8B65 for ; Mon, 08 Feb 2016 11:40:13 -0500 Received: by mail-wm0-f52.google.com with SMTP id g62so124516763wme.0 for ; Mon, 08 Feb 2016 08:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=nhKNdJbY8tleMLzOG+o6qURKSEAaZB29xbTrNQ+Moew=; b=ps+kLuEdCuzAu9RKrYmkGVFi0sAXM1JZ1iE8GO2k40xk1jZUfswBzIy82hPHtFFbV1 nk0QxIFL0poSfFwuer9C9Kk33yereJ1MuHUeN5mQlQ6x88wqJtcBdTbG+EZtmAqiORCw 73fqPT071Za+sGeeljwn4ouG29KHZMBnTt08QYFoT+eXye/7DHYmWTifjNRAcF77eHd/ 1sRgwmpwWcR+1a3i30Br4se5SgCgNnYPxUc3nOVPCW5vS3pBYXPcHv2XcZvfPHWG0brd e423xXxBbHfsQ3O0YcE1SJeUTTDjKK7u5xFI2AyOAEXhlYjXgfaZA7fhGjAMYZYfNaP6 Gybw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=nhKNdJbY8tleMLzOG+o6qURKSEAaZB29xbTrNQ+Moew=; b=hFEbtnSKwTAGgENNi6mbIBCR2J4YEEchbrftMQve2tJn41nGqVfQGf9SWdZ8s7hxZB Z1jt9IkKus86OpTAFif0K4IuFTDkgkMNAqpctN1U7U1cxKWX7zzwSjXYb/mYVcdgex8J JFa57tyvCMu/UXAQp+xHzc9ujFlc3l4soPVzV44qBC0g6NGDEuOiyIykU/u2WkN/ZXhz zzs4q8Zya/GANv4gLJiWwJKtDFC/E0nl7HBKFB+TCOYe6rD17y9TGnBXFqld6/eo8rP0 vsntkEWaHOCO3SjZvIZ/o8oejzpceUgg3iBRJNrxyWDBo7n7Y07kh08TmuFCAA6viV3D F7rg== X-Gm-Message-State: AG10YOSiWPC6GvFefP4XzuVka+VOEB6pAEPViThzWWOSnfWE0lqo4hgyW87r8z6cIoVTiA== X-Received: by 10.194.123.228 with SMTP id md4mr28935119wjb.6.1454949608823; Mon, 08 Feb 2016 08:40:08 -0800 (PST) Received: from [192.168.0.152] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id r62sm13313746wmd.15.2016.02.08.08.40.08 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Feb 2016 08:40:08 -0800 (PST) To: internals@lists.php.net References: Message-ID: <56B8C492.2060800@gmail.com> Date: Mon, 8 Feb 2016 16:38:42 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Proposal for a new array function From: rowan.collins@gmail.com (Rowan Collins) Kinn Julião wrote on 08/02/2016 16:05: > That's the nice thing about userland... you are giving them ability to > implement what they want! > `array_filter([...], 'is_int', ARRAY_FILTER_USE_KEY)` does the job as the > others... don't think having a new function would prevent this. It does the job, but it is much less efficient in some cases than the foreach and return false case, as it must examine every element; it also has unnecessary memory overhead, creating a filtered list which exists only to be counted and thrown away; and an internal implementation could be optimised even further by exploiting the way the engine stores the array internally. PHP is at this stage expressive enough that a large number of core functions could be rewritten in multiple ways using other core functions, but that doesn't automatically rule out adding more functions to core where it is useful to do so. Regards, -- Rowan Collins [IMSoP]