我有以下 If 语句,我想让它更短(例如,单行),而不是在一行中写下我的 if 语句。
if ($start + $count > $total) {
$count = $total;
}
基本上我想实现$count
+$total
永远不会更高$total
,如果是这种情况,我想设置$count
等于$total
.
你可以使用min()
:
$count = min($total, $start + $count);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句