Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123862 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 72C571A009C for ; Wed, 26 Jun 2024 08:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719390323; bh=NXM/UnlCXevHhclThA2kmxPS3TYIRJ6JpJxalZ132Nw=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=jHB9pG2j3tqs9EKrplbcdzE7ZMtt2zZ1EUccwgsrb36HMyIgo/P7K3OhFe7qLnTal j6QI18qftd0H8wf5k+rplnGrLktPW9/DA+Au4N7erzej4WY0QNhF3NUJQ/91RbyCdH l/iXIUS/89cTjipDx8L6jTUhV0B++CTJgcwEmLxW2Zt0qCQQCuLowzitRa4iMs6b0i 8dVbiCNfq1SSlafOajC1sN6bz8RJoQhuJAh7zzfUmDdxZzZVZiqnnM2SB/NMA0oGJX eFJalT4u10NWOzqWiyOUG4goxkbk2M/6X3QGDtsqFxAEF3r6EVzwzOlZKHgmDkoaI1 UamyntWBRnEdA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 808DA180729 for ; Wed, 26 Jun 2024 08:25:22 +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)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 26 Jun 2024 08:25:22 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 5259313804FA; Wed, 26 Jun 2024 04:24:04 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute1.internal (MEProxy); Wed, 26 Jun 2024 04:24:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=1719390244; x= 1719476644; bh=NXM/UnlCXevHhclThA2kmxPS3TYIRJ6JpJxalZ132Nw=; b=S bs4JijdmLIAsmJDYGCyaq/ZuY8SCH96syhRUi8iejkald1KBwuzyDoTcgRfebWRq UJMMOQ/5N5xQ8l14AjU77zfMbPQYPlYdx/vfmUol+dx4Oh2VHMGeJ8BmPD5KLwxT 5AN+ehBIZILYef8En5PWJkpRtocAEgZleqp+shrGRMMz68RQLYrEuZE5asAD2k6z M14DGQuFM/W2JppKlPxc0bLr/npsJ9YbhMtjRbtQCMcaGv26+qT1HmrpHB2J9759 f1w51xrkwUJYUYHJJP/aRq7mhJ3H3Egjc08Iu7zGd3sB1NU2MpB+ZV7UTtkdG+x5 CqxstQ8LSWVBnaWcyxljA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1719390244; x=1719476644; bh=NXM/UnlCXevHhclThA2kmxPS3TYI RJ6JpJxalZ132Nw=; b=UjVxiyVY1/DGgLDJOuur1UK2oSUAfQG/VVwHGAhJHA23 EMu8FZfrogOMwuDm1cBCedSwqsd0UN+HChDHqZzCfFAUp2uE9iV4QoJ6H984aUP7 6x3Zf90wE2rPkPBr+3dAez/x9yr6WFSRaaE5+nYProXSCUt1owPGoxF9+0gJX/Gg dBuQaEXxP+bZMOHcFlQJuFzSuR3SLQksiKYuHgbXWKeyRABMXWsVvr7eN+CNBkfR CRc7U0Gl0EPsbvSkDbzxPHG57QIqvPuiKR8hPfUagzzo5npV5z6/IrmbIf4TfWSo WNNpeM1P36GnV4bBpQFaYxGZumia99cNUqMK/KG27A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddvgddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefofgggkfgjfhffhffvvefu tgesrgdtreerreerjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgsse gsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpeeiuedvvdefteevkeei keffgedufeehgfekuddtveeiieejfeejkeduueegjeejveenucffohhmrghinhepfehvge hlrdhorhhgpdhtrdhmvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghs X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E4BE215A0092; Wed, 26 Jun 2024 04:24:03 -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: In-Reply-To: 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> <54ec7ee2-aef2-4e70-accd-e94babbb2e48@app.fastmail.com> <5e7f4e03-d7ff-441c-97b1-42a69e6543a1@app.fastmail.com> Date: Wed, 26 Jun 2024 10:23:42 +0200 To: "Arvids Godjuks" Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching Content-Type: multipart/alternative; boundary=e438413defca4884b985782a01f3af1c From: rob@bottled.codes ("Rob Landers") --e438413defca4884b985782a01f3af1c Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Jun 26, 2024, at 10:11, Arvids Godjuks wrote: >=20 >=20 > On Wed, 26 Jun 2024 at 11:00, Rob Landers wrote: >> __ >>=20 >>=20 >> On Wed, Jun 26, 2024, at 09:54, Rob Landers wrote: >>>=20 >>>=20 >>> 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 res= ult 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 i= nfinite nulls=20 >>>> > IN the array. You can write a for loop of all possible keys until= the=20 >>>> > end of the universe, and all you will get is null. This is fairly= easy=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 >>>=20 >>> If you are accessing them by index, yes, they are all the same array= . There is no observable difference. I think we already covered that cou= nt() would show the difference between them since it=E2=80=99s actually = a count of known indices: >>=20 >> Sorry, I=E2=80=99ve not yet had enough coffee, this should be: >>=20 >> $arr =3D []; >>=20 >> for($i =3D 0; $i < 4; $i++) var_dump($arr[$i]); >>>=20 >>> Will output 4 nulls.=20 >>>=20 >>>=20 >>> =E2=80=94 Rob >>=20 >> =E2=80=94 Rob >=20 > You are only half-correct. > It will also output 4 undefined index warnings in strict_types=3D1 mod= e :) https://3v4l.org/DJ4AI It will always output that warning, regardless of strict types, but as t= his thread has already covered numerous times, it is unobservable from t= he executing code unless you turn the warning into an exception. >=20 > -- >=20 > Arv=C4=ABds Godjuks > +371 26 851 664 > arvids.godjuks@gmail.com > Telegram: @psihius https://t.me/psihius =E2=80=94 Rob --e438413defca4884b985782a01f3af1c Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Wed, Jun 26, 2024, at 10:11, Arvids Godjuks wrote:
=


On Wed, 26 Jun 2024 at 11:00, Rob= Landers <rob@bottled.codes> wrote:



<= /div>
On Wed, Jun 26, 2024, at 09:54, Rob Landers wrote:


On Wed, Jun 26, 2024, at 00:19, Morgan wrote:
= On 2024-06-26 08:24, Rob Landers wrote:
> On Tue, Jun 2= 5, 2024, at 20:23, Ilija Tovilo wrote:

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

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

What about the difference between an empty arr= ay an an array that 
contains a null (Ilija's example= )?

echo count([]);
echo count= ([null]);
echo count([null, null]);
echo cou= nt([null, null, null]);
echo count([null, null, null, null= ]);
...

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

<= br>
If you are accessing them by index, yes, they are all the = same array. There is no observable difference. I think we already covere= d that count() would show the difference between them since it=E2=80=99s= actually a count of known indices:

Sorry, I=E2=80=99ve not yet had enough coffee, this should be:
=

$arr =3D [];

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

Will out= put 4 nulls. 


=E2=80=94 Rob

=E2=80= =94 Rob

You = are only half-correct.
It will also output 4 undefine= d index warnings in strict_types=3D1 mode :) https://3v4l.org/DJ4AI

It will always output that warning, regardless of = strict types, but as this thread has already covered numerous times, it = is unobservable from the executing code unless you turn the warning into= an exception.


--

Arv=C4=ABds Godjuks<= br>
+371 26 851 664
=
Telegram: @psihius https://t.me/psihius

=E2=80=94 Rob
--e438413defca4884b985782a01f3af1c--