Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91199 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62462 invoked from network); 11 Feb 2016 11:59:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2016 11:59:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; 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:38207] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/38-25203-BB77CB65 for ; Thu, 11 Feb 2016 06:59:55 -0500 Received: by mail-wm0-f52.google.com with SMTP id p63so65111695wmp.1 for ; Thu, 11 Feb 2016 03:59:55 -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=FGX0bQ8FcnxvTKTxzmKvFSn/d2KumqJNppCcJFWwTsQ=; b=UyFGcflP1QBuknC1UsOGHDPOjnjUxd/gfdzPrJCTsY4IntEimyy/Rg1/HnSop4Ty/h MOUBOuALd9UIPqQs1uMwtqzBQlHNDn0G+IJjSqUR4Ntst1nsDPBfcf/rF+PI127atSpl d6Z7z5zWBmV/MBSfedKIB4Y79KRGnNM+RzDaegP1NN66j6paRRdUckuLoQbzB4Ar4YXs GQgKgXlRKMvziUen/iE/ttOe4YqEra1HSpFcuTShAfp14/pYiH9c/4nHwJ24s9YIeZPp uGF8JjY6nU6tiRH8GVjw9wLR8/CibuFJixaZ+3Awrq5fC9j58Q99iGNdeLPeU29JXM9V +XUw== 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=FGX0bQ8FcnxvTKTxzmKvFSn/d2KumqJNppCcJFWwTsQ=; b=RTgXNqP2FuL7LuuQi/IeOgpruT2DJQzZFGlUc8qHzN/ORB0c23UWQ8FyMZHyR+MXdN v3TtSEieB+XjrHpoS3DO9WR58z0yqcA/VG9b5SEZC5inIXmt0UVERKyfn70pRDMPfsoJ IrqDR8WBxoGFDsuug8rSY35gQGWLC1GERQ+qwg9pZvqarkGjPukaD1FNZ60f5DBdquw9 a6Ckz0fYLqFubrTPWbQV/mMC7wovtI6yA3qfP8M9ZtLp+nZYlF5gzqpG1Zan6R4TuOs/ NDEM6mkxgVo8VDH/fL6+s3Gm9bxHm7VhOvLGFy6b58l/ov9fMn6xZPQ1eSUlpZcpUFgq ayRQ== X-Gm-Message-State: AG10YOQE6UeZ2wNQ5XcdHc9UNkOn66I0z7aVQZWIoW9atX5VQFfgCem8krE3/UJnW50zww== X-Received: by 10.28.51.74 with SMTP id z71mr9296767wmz.15.1455191992677; Thu, 11 Feb 2016 03:59:52 -0800 (PST) Received: from [192.168.0.152] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id r62sm7733989wmd.15.2016.02.11.03.59.51 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Feb 2016 03:59:51 -0800 (PST) To: internals@lists.php.net References: <0ae84dfa8fc306e36d2241b6cd91fa10@kw04.serverdomain.org> Message-ID: <56BC7752.3050509@gmail.com> Date: Thu, 11 Feb 2016 11:58:10 +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: <0ae84dfa8fc306e36d2241b6cd91fa10@kw04.serverdomain.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Proposal for a new array function From: rowan.collins@gmail.com (Rowan Collins) Christian Wenz wrote on 11/02/2016 09:17: > On Mon, Feb 8, 2016 at 09:32 AM, Matthew Setter wrote: > >> The approach I took was this: >> >> return array_keys($arr) !== range(0, count($arr) - 1); > > FWIW, this might not work for arrays with missing indices like [0 => > 'a', 2 => 'b'] > > I personally would appreciate a function like you proposed. This is why the exact specification - and name - of any proposed function needs to be considered carefully. In many cases, what you actually want to verify is "is this a pure list / vector?" in which case you might *want* that array to return false. A naive version of which would be "$arr === array_values($arr)".