Any more concise way to set default values?
问题 Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise. Is there any better or more concise way than following code to set default value of variables? $v = isset($v) ? $v : "default value"; 回答1: Here is a shorter syntax: isset($v) || $v="default value"; 回答2: TL;DR - No, that expression can't be made any shorter. What you want is for the shortened ternary expression to perform