This is a minor thing, but it's been bugging me for a while. I've wracked my brain for a way to write statements like this without any repetition of code. For example:
echo isset($array[0])? $array[0]: 'not set';
$var = empty($other_var)? '$other_var not set': $other_var;
Is there some sort of test-and-return (for the former) or test-and-set (for the latter) operator I don't know about? This may seem like a minor point, but the duplication seems unnecessary and can lead to very long lines that can complicate maintenance. Consider:
$another_var = array_key_exists($array[Utility::FindIndex($username)][Constants::App_CRITERION], $haystack[NthDimension('my dimensional indicator')])? $array[Utility::FindIndex($username)][Constants::App_CRITERION], $haystack[NthDimension('my dimensional indicator')]: 'not set';
Yes, yes, the above line is totally contrived but it's not unthinkable that something like this could occur. It just seems strange to me that there isn't a way to test something and assign it's value (if true) without repetition without repetition.