I'd like to do this:
$matched_tags[$tag]++
As a simple way of keeping track of how many times a given $tag is found during a loop.
This appears to be throwing a NOTICE the first time any new $tag is encountered, because the index is undefined. PHP kindly autovivifies it, sets it to 0 and post-increments it, but throws the NOTICE anyway.
Now I like to develop with Notices on as a best practice, so I don't want to suppress them. But to me what I'm doing isn't notice-worthy.
Do I really have to:
if ( ! isset ( $matched_tags[$tag] ) ) $matched_tags[$tag] = 0;
$matched_tags[$tag]++;
Oh that is so painful. Please tell me there's a more elegant way, or I swear I'll switch to Perl so help me.