Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123861 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 96FA41A009C for ; Wed, 26 Jun 2024 08:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719389613; bh=EyDpDEdmntoYpkAVwD14IgJ4jzUKw+zS3OV4x51Y7gY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kQEwv33u2op6HRHp51Ppa3RiWSYGaU0OyGXgEcV2JBbIpu8TNaQcEqrP4bHBIIXQ8 TSgBm4LBCdoGhQTFfn1FpXo6oe2rhAbD3e/GvCxUHUQDyeq4266D/NNFJHUvqtG3EA 9PW9AoHQO4bmMNzOOfYrsIuzn+Zdgb8bImeE698WwCSFCYpojzwtiS9L2hvXBMy0/+ GNYzDoYOZPBa6nVC09UzfujuLLyOICTj/S3jzAd0Nq1jwSdZXkoOw5rkQbKimPBxtK XB6niwLNGgIG1CUnHB7JRILi110Eags2TJ2vzCZGxqppr9jlWmQeFLJAAQPpHOPzVA V6NAW6n4IY39Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DBF891806C9 for ; Wed, 26 Jun 2024 08:13:32 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, 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 mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 08:13:32 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5295eb47b48so7567578e87.1 for ; Wed, 26 Jun 2024 01:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719389533; x=1719994333; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EyDpDEdmntoYpkAVwD14IgJ4jzUKw+zS3OV4x51Y7gY=; b=NZe+NZjfUecKy/Xkay5FfU3fv0GGxuGxQKn79JyCdlp2E3Acw2BaEdVl5OTpPxNcH3 Jm5n6zJTI7S5vVKEV0AMKc72t4fv3uAeab3KfLmXKcPxu4OfNNnAx0XMIfuDuFuiBHx+ bc1Ffhuj972hWV9BAi6CfvgjaZlyMD5RAG+0h/IJeEvpq5/v9LkZngFbAx83QBM7wGaC sehA0Y6txMuQe60TxdQUhhWaX8PZ7TAJXwaFtE5/Ozwi5VlK4rGDPOx2bDd1+yuDm5f4 nfJNtZ4sVa2lzDhu/pB5j2KQYSI3n879XNbKgHBudefJJlNsGtZ5+0/oaikEOqlBG/WD JfRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719389533; x=1719994333; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EyDpDEdmntoYpkAVwD14IgJ4jzUKw+zS3OV4x51Y7gY=; b=LQKd7+QZx+eMa6HnA5OO47jS9I2RMJeXBSlKUid2QHhIb2XffRPqzPEfRaC8mGF60Z 4Tjs2R5EAffhCN7IhkchNNaPDql29O3bJkEZxproQ6da7DjpAgmQzvHefADECTlrz+cQ c3tEl4msKnKaubUvMU2H5UXerPpsN7j5+fJmWUfmjjUY7RMK5dqCu4ANrkHMECVvmEap AYAgy6QR43A+STNHKYT1VfxZTohn1FrGlcXtk6PvTOAoeMC8PTm7A8Z6l43jcNIl6ntg YS9lv3YfTo/ZU5+Eliyf6omGtgugFl7pUlMW5qqJ/Ky1DYJgkuWPe4EKGi/qQBKFS5/d RXWw== X-Gm-Message-State: AOJu0YyM4VRN7pBr+bEeBjtxwU1Ygtg2gxtgH0+SHp+qqfXQXnLTx96X ySlH/yW/xfIvqTPOxXfHCV79Yl+Fmv8x4Zpen4lI0QkZ5cO0GxX7gNX5RN1ND9r7wqJ7/Tmartw VQA3tya1rAhCDt3TdBgHPPlJBTfQX4LQj X-Google-Smtp-Source: AGHT+IEtEzb3HOc8bIRjBeEgKP9HoQ7sBqJn8d4PsRVUW0sYlEnMMT7Zugn6prtoxk0AQBV5aCdg+sfqHVIWKVSyesk= X-Received: by 2002:a05:6512:114c:b0:52c:ebd0:609 with SMTP id 2adb3069b0e04-52cebd006bdmr6612390e87.7.1719389532922; Wed, 26 Jun 2024 01:12:12 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 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> In-Reply-To: <5e7f4e03-d7ff-441c-97b1-42a69e6543a1@app.fastmail.com> Date: Wed, 26 Jun 2024 11:11:36 +0300 Message-ID: Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching To: Rob Landers Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000572c4b061bc692ec" From: arvids.godjuks@gmail.com (Arvids Godjuks) --000000000000572c4b061bc692ec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 26 Jun 2024 at 11:00, Rob Landers wrote: > > > 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 25, 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 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 > > that is (hopefully) self-evident. I=E2=80=99m talking about the infinit= e nulls > > IN the array. You can write a for loop of all possible keys until the > > end of the universe, and all you will get is null. This is fairly easy > > to prove. I'll wait... :p > > > What about the difference between an empty array an an array that > contains a null (Ilija's example)? > > echo count([]); > echo count([null]); > echo count([null, null]); > echo count([null, null, null]); > echo count([null, null, null, null]); > ... > > You're arguing that these are all the same array? > > > 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 count(= ) > would show the difference between them since it=E2=80=99s actually a coun= t 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 output 4 nulls. > > > =E2=80=94 Rob > > > =E2=80=94 Rob > You are only half-correct. It will also output 4 undefined index warnings in strict_types=3D1 mode :) https://3v4l.org/DJ4AI --=20 Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Telegram: @psihius https://t.me/psihius --000000000000572c4b061bc692ec Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


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


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

On Wed, Jun 26, 2024, at 00:19, Morgan wr= ote:
<= div>On 2024-06-26 08:24, Rob Landers wrote:
> On Tue, Jun = 25, 2024, at 20:23, Ilija Tovilo wrote:

>&g= t; If null array values were indeed unobservable, then [] would be =3D=3D= =3D to
>> [null] (or at least =3D=3D), and a foreach ov= er [null] would result in 0
>> iterations. But neither = of those are the case.
>=C2=A0
> I think = there is a difference between an empty array and a null, and=C2=A0
> that is (hopefully) self-evident. I=E2=80=99m talking about the = infinite nulls=C2=A0
> IN the array. You can write a for l= oop of all possible keys until the=C2=A0
> end of the univ= erse, and all you will get is null. This is fairly easy=C2=A0
> to prove. I'll wait... :p
>=C2=A0
= What about the difference between an empty array an an array that=C2=A0
=
contains a null (Ilija's example)?

<= div>echo count([]);
echo count([null]);
echo co= unt([null, null]);
echo count([null, null, null]);
<= div>echo count([null, null, null, null]);
...
<= br>
You're arguing that these are all the same array?


If you are accessing them= by index, yes, they are all the same array. There is no observable differe= nce. I think we already covered that count() would show the difference betw= een 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 [];

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

Wil= l output 4 nulls.=C2=A0


=E2=80=94 Rob

=E2=80=94 Rob

You are only half-corr= ect.
It will also output 4 undefined index warnings in strict_types=3D1= mode :)=C2=A0https://3v4l.org/DJ4AI=

-- =
--000000000000572c4b061bc692ec--