On 16 January 2014 10:49, Matthieu Napoli <[email protected]> wrote:
> The performance penalty is the same as if you were type-checking yourself.
(Sorry if I'm stepping on your toes here Joe, since it was you who
pointed this out to me):
This is not completely true. With arrayof, there are two iterations of
the passed value - one in C and one in PHP, vs only one iteration in
the foreach/instanceof approach.
However:
- as you point out, the performance penalty for the check is
negligible if it even exists
- if you don't use the syntax there is no penalty whatsoever
so for me this is a complete non-issue. The concise syntax and strong
semantic possibilities this brings far outweigh a few microseconds of
slowdown.
Thanks, Chris