Foreach() Skips Uninitialized Properties

no-email (Damien Seguy), Damien Seguy
Sun, 26 May 2024 00:00:00 +0000

Foreach() reads naturally all public properties in an object. Protected and private are omitted, unless in the right context.
Foreach() also skips silently uninitialized properties: this prevents the generation of NULL values, but also, skips all readonly properties: any direct hit on such property would otherwise generate a Fatal error.