Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123859 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 325901A009C for ; Wed, 26 Jun 2024 07:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719388599; bh=i75D6rdrpGBX7DAsQQiQyEa3P+FHzpxvr6myN6PfQ48=; h=In-Reply-To:References:Date:From:To:Subject:From; b=WhdAXII4vtDocG881X0sVyUgayDW/FXCqiwbDOT65iX/E/uXkpvRyc9lnxHY26Ibi nvzRIisLZTuIS8gntDcleyucjbiwAUGthCze/k6PHN+Rm9CDE1w5N39THDANgtOvpy 2+K5xoHAUUwZn6IoQCAArT4DHIoMX9bRWenB2QhepBC9d05MLwgRzjT2QnsNF0Zfi8 01l6JmLK0dKZiLBuJDLH0chJxcGxf4GsN5qCdYhkX0ZPR/L0hBEf2bvCq3e6Ot6TA0 ZZGQ7t1zjGZJ5OLqzy/eySCW/aejQxYujF8ZxBLVWb/8UnzXezR76d8GyB4xGrBXBG vafeENkktBRVw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4125718003F for ; Wed, 26 Jun 2024 07:56:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 26 Jun 2024 07:56:37 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 7B74F1380605 for ; Wed, 26 Jun 2024 03:55:19 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute1.internal (MEProxy); Wed, 26 Jun 2024 03:55:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1719388519; x=1719474919; bh=i75D6rdrpG BX7DAsQQiQyEa3P+FHzpxvr6myN6PfQ48=; b=nsbdb7Zr8j3yekV4yEcW99vB/G vQJGb3VEYdE47GJG112mCtPY2inhQDqZaf/v4yz/3Jgn+PemGPuRsFiNS2nKUxAb ARMT9Vkv91ySo95rR2zsu+nQsYCbKT/Q5xsiX40z04iYY5TYt8B92/uYGnnnnjYw ikvBaxVNO69KMUcDA1SdtYEChAvEJInwALvEJU0oOv+9JacOQByvNMS08csPKmuJ Smx1H96Wxk+ozmqoESdjW5+usrZDyGuCJT7fmnlkY55HXO7YmOpU9dyLlcke2OjL pylMnG1vUWp+ffQE08fMJ7VF4YhGRU4HR9BziTtTCw3sb4UMdg4D779LlSMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1719388519; x=1719474919; bh=i75D6rdrpGBX7DAsQQiQyEa3P+FH zpxvr6myN6PfQ48=; b=W78Y3707AVg7NOHEIqN94LbxrtC0kiM6L2R6/6pkqKcm 7gwIjuheemr46nfRaitygnP3nU32MyylfzO7zC4Fi8ABTdahY7u1OwS07ESPyOms vkL5Kl2AJ8FKqS5WVdQxieQkE4+VtM1NNDPbLsHAZKN8If1ZHxZ2y8QlbLMjXaMq GRnShGAnkL/JoX0nYxixZX6rFmowkdmKTsjLthSHhRri7HyHxn8PGcHaCBIaNjqq KqKxatquPFsWByW/CyYZkhEiD9fGYcIYE5oiDtNUzuFIt3Qwk0UAZ1M82r1yDa0k brVA8AYTEsAWrF0Tjk4ftKt7PGuets8nt2K9TSTAuw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddugdduvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerreejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothht lhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepfeefudfhudduieekkedugffhud fgleejgfekgefhvdeikeelvddvjeehteegteegnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggvsh X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 242E515A0092; Wed, 26 Jun 2024 03:55:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <54ec7ee2-aef2-4e70-accd-e94babbb2e48@app.fastmail.com> In-Reply-To: <8088812c-27f5-4c30-baaf-57d36af1ec08@varteg.nz> References: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> <1E295280-619B-4490-B53C-0899B64F9215@chaz.works> <97a93ae2-5202-47eb-bf51-ec1e976ea765@app.fastmail.com> <8088812c-27f5-4c30-baaf-57d36af1ec08@varteg.nz> Date: Wed, 26 Jun 2024 09:54:58 +0200 To: internals@lists.php.net Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching Content-Type: multipart/alternative; boundary=070f8ed1e82b4e55953ad489e259975a From: rob@bottled.codes ("Rob Landers") --070f8ed1e82b4e55953ad489e259975a Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 26, 2024, at 00:19, Morgan wrote: > On 2024-06-26 08:24, Rob Landers wrote: > > On Tue, Jun 25, 2024, at 20:23, Ilija Tovilo wrote: >=20 > >> If null array values were indeed unobservable, then [] would be =3D= =3D=3D to > >> [null] (or at least =3D=3D), and a foreach over [null] would result= in 0 > >> iterations. But neither of those are the case. > >=20 > > I think there is a difference between an empty array and a null, and=20 > > that is (hopefully) self-evident. I=E2=80=99m talking about the infi= nite nulls=20 > > IN the array. You can write a for loop of all possible keys until th= e=20 > > end of the universe, and all you will get is null. This is fairly ea= sy=20 > > to prove. I'll wait... :p > >=20 > What about the difference between an empty array an an array that=20 > contains a null (Ilija's example)? >=20 > echo count([]); > echo count([null]); > echo count([null, null]); > echo count([null, null, null]); > echo count([null, null, null, null]); > ... >=20 > You're arguing that these are all the same array? >=20 If you are accessing them by index, yes, they are all the same array. Th= ere is no observable difference. I think we already covered that count()= would show the difference between them since it=E2=80=99s actually a co= unt of known indices: for($i =3D 0; $i < 4; $i++) var_dump([]); Will output 4 nulls.=20 =E2=80=94 Rob --070f8ed1e82b4e55953ad489e259975a Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Wed, Jun 26, 2024, at 00:19, Morgan wrote:
On 2024-06-26 08:24, R= ob Landers wrote:
> On Tue, Jun 25, 2024, at 20:23, Ili= ja Tovilo wrote:

>> If null array val= ues were indeed unobservable, then [] would be =3D=3D=3D to
>> [null] (or at least =3D=3D), and a foreach over [null] would = result in 0
>> iterations. But neither of those are = the case.

> I think there is a= difference between an empty array and a null, and 
&= gt; that is (hopefully) self-evident. I=E2=80=99m talking about the infi= nite nulls 
> IN the array. You can write a for lo= op of all possible keys until the 
> end of the un= iverse, and all you will get is null. This is fairly easy 
> to prove. I'll wait... :p

<= div>What about the difference between an empty array an an array that&nb= sp;
contains a null (Ilija's example)?

<= /div>
echo count([]);
echo count([null]);
echo count([null, null]);
echo count([null, null, null])= ;
echo count([null, null, null, null]);
...<= br>

You're arguing that these are all the same = array?


If you a= re accessing them by index, yes, they are all the same array. There is n= o observable difference. I think we already covered that count() would s= how the difference between them since it=E2=80=99s actually a count of k= nown indices:

for($i =3D 0; $i < 4; $i++= ) var_dump([]);

Will output 4 nulls. <= /div>


=E2=80=94 Ro= b
--070f8ed1e82b4e55953ad489e259975a--