That is less powerful than the example I posted and gains you nothing. Three tested states are uninitialied, undefined and defined. My snippet replaces your defined() test with an exists() test which diferentiates between non-existant elements and merely undefined.
The "different" way I was thinking of would probably use something other than for() since for() also returns uninitialized elements. It's not sparse aware. You know - something like each() for arrays.
Fun Fun Fun in the Fluffy Chair
In reply to Re^4: Sparse arrays?
by diotalevi
in thread Sparse arrays?
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |