Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63278 invoked from network); 8 Feb 2016 15:44:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2016 15:44:15 -0000 Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:64932] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/A3-36326-DC7B8B65 for ; Mon, 08 Feb 2016 10:44:14 -0500 Received: from [127.0.0.1] (unknown [82.240.16.115]) (Authenticated sender: flaupretre@free.fr) by smtp2-g21.free.fr (Postfix) with ESMTPSA id 072254B01CF; Mon, 8 Feb 2016 16:41:38 +0100 (CET) To: Matthew Setter , internals@lists.php.net References: Message-ID: <56B8B7C6.6000206@php.net> Date: Mon, 8 Feb 2016 16:44:06 +0100 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 X-Antivirus: avast! (VPS 160208-2, 08/02/2016), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] Proposal for a new array function From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Le 08/02/2016 15:32, Matthew Setter a écrit : > I want to propose a new PHP array method, called has_numeric_keys (or > something similar/better), that would have the following method signature: > > bool has_numeric_keys(array $array) > > The reason for it is to check if the array passed to it only had numeric > keys. Interesting. If you want to check that your argument has numeric keys *only*, you should change the function's name. For a better consistency, may I suggest a function that would allow to know whether array keys are all numeric, all strings, or mixed. Something like array_keys_type() returning one of 3 predefined constants : ARRAY_KEYS_NUMERIC, ARRAY_KEYS_STRING, ARRAY_KEYS_MIXED. Regards François