Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102317 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56120 invoked from network); 20 Jun 2018 09:17:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2018 09:17:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=enno.woortmann@web.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=enno.woortmann@web.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain web.de designates 217.72.192.78 as permitted sender) X-PHP-List-Original-Sender: enno.woortmann@web.de X-Host-Fingerprint: 217.72.192.78 mout.web.de Received: from [217.72.192.78] ([217.72.192.78:55447] helo=mout.web.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/22-32156-7BB1A2B5 for ; Wed, 20 Jun 2018 05:17:44 -0400 Received: from [10.129.18.221] ([194.76.42.30]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MHGil-1fQuGd1mpX-00E3nb; Wed, 20 Jun 2018 11:17:40 +0200 To: Levi Morrison Cc: internals References: <75db877c-ef0b-7d3b-48a8-9879d90352b0@web.de> <76e4744f-6722-ee49-0325-e4433236f1b1@web.de> <73ac8914-8c9f-e74b-a4f5-f6e39cd96f8f@gmx.de> <3242366.BL9MUqXe46@vulcan> Message-ID: <154ba124-2915-ca36-fa39-5df6726d3b5a@web.de> Date: Wed, 20 Jun 2018 11:17:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:me3TT/7wZhuSgRNPe2dNg+7QRlwLlq7NonsqSv/EYcnmT5otOi8 6a3kB4uGeAuTpUVFQ4TaCdNXdpULMtB8QwLPLeESsgKdM6Sbx/Strgx6RRNuW2f0+Ys48gK diJUHADb5T/P9bZr3kSWp4dBYAsAq8S+tULoaSEgMBz/bxXMCx7P0rru0pHtVYJKDs53oK2 WYTwAAZ6yC6BPpE/mIJlQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:FXMEWTIWTr4=:GJXtOmKZXefvlr4JRfwg54 OvCLalrelPlkESPb1LjdlcHlC2bjdpaCjGeQlSI+xRGHotv9qQitEm/Nm828fs6D7iZMZiHqu bApWT5j6hTO/M6k3t5+tcjV7hOomQIDLolvvBaey14JW5pZd3MQkHyPawrLN+chhGLKaIjhJz vUaMQtiPvAjZRSK6prwpsiUPLnVQnHhbM8HEK2/kPvhI3eDgvYZQzda9Qv3fi4YtdIEcsszCK QvQyj3YTUspcfxD0X14ZY8r2/fVCWk53EdUgbXdH7RG4VlaIdRyaGKevqwMO4/7rFEnN9ZNMB ictHVypuC3j4/SPtRLkKIhJPkLmeQ3elxxWdgZ7zBQKmFTGNn8QHg/LXG0G7t6XEIlp2ihJNo eFJSz3eYoHaJi/2C8O2IxfuDmNLjpQuUDzJpyY1X61M+hlu6qCl+4EB1mO2W42SzAFvqQscg/ COg9q0KQxJfHrYDVCaT5Lu6MAV6TZ3QgBHnrZdRmbHJ/2Pn1oC7R8dYO6d/0exHCtb+7fA76K 8Y5Qu082u7Uu4N8psDrIKQnspkZ5xTnkoLFCVXWkteftS19+NrXSPdDMrP9RBEKHnVslRB1we 3ADLx4QSgsrj2Q9Awe5Z5RQOxQ7OlJhOuAJWsYpikGyaoa/E66ajLlPJYH9mXSbUQH5DgUb1e UqzDIQmjTuPUrz6Xx8apCPOAdrrgoGRpvLYH+b8LQXCsMikF1/07al7xQfardaftfDtzG3xH0 v+QddISCwJmbRo2wqdFbvd0p7eZANLNq0Y9nj5s4D+OCftzqPfTKms/Er19q+n+Nw5rRqdugD vOdMpjY Subject: Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last() From: enno.woortmann@web.de ("Woortmann, Enno") Hi Levi, Am 20.06.2018 um 04:47 schrieb Levi Morrison: > list($key, $value) = array_first($input); > // $key will be null if the call failed > > list($key, $value) = array_last($input); > // $key will be null if the call failed Your proposed functions would be implementable with the internal functions but I think this approach doesn't provide a clean function interface as it forces the user to evaluate the wanted value from the returned array structure by using either the list() construct or something like $key = array_first($input)[0]; I believe two functions with this interface will be confusing and less intuitive for the developer. If I use a function I expect it to give me a return value which I can use without any further post processing $wantedValue = fancyFunction($someInput); Enno