Re: [Early Feedback] Pattern matching
| From: | Morgan | Date: | Tue, 25 Jun 2024 22:19:49 +0000 |
| Subject: | Re: [Early Feedback] Pattern matching | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123851@lists.php.net to get a copy of this message | ||
On 2024-06-26 08:24, Rob Landers wrote:
On Tue, Jun 25, 2024, at 20:23, Ilija Tovilo wrote:
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 null array values were indeed unobservable, then [] would be === to [null] (or at least ==), 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’m talking about the infinite 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)?