Possible Duplicate:
More concise way to check to see if an array contains only numbers (integers)
PHP checking if empty fields
我有一个提交 10 个字段的表单,其中 7 个应该填写,下面是我现在用 PHP 检查它的方式:
if (!$name || !$phone || !$email || !$mobile || !$email || !$state || !$street || ! $city) {
echo '<div class="empty_p">You have empty fields!!!</div>';}
else{
//process order or do something
}
我的问题是:是否有更简单的方法来做到这一点?因为有时我有更多的字符串要检查 (12-15)