Foreach() Skips Uninitialized Properties

../_images/foreach_skips_uninitialized.png

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.

See Also

PHP Features