Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有更清洁的方法来执行以下操作:
if (isset($foo)) { $bar = $foo; }
检查一个值然后分配它似乎是多余的。
也许你可以使用
$var or $var = 'default value";
使用运算符有点脏,@但是:
@
if ($bar = @$foo) { //do something }