如何使这个PHP语句更短?

如何使这个PHP语句更短?,php,Php,如果条件较短,则将其缩短 if($birth_date>30&&($birth_month==2||$birth_month==4||$birth_month==6||$birth_month==9||$birth_month==11)) 将出生月份的可能值放入数组中 $birth_month_values= array(2, 4, 6, 9,11); if($birth_date>30 && in_array($birth_month,$birth

如果条件较短,则将其缩短

if($birth_date>30&&($birth_month==2||$birth_month==4||$birth_month==6||$birth_month==9||$birth_month==11))

将出生月份的可能值放入数组中

$birth_month_values= array(2, 4, 6, 9,11);
if($birth_date>30 && in_array($birth_month,$birth_month_values))

你试过什么吗?听起来更像是我们应该做你的工作,我们不会“请”,“我做了什么”,“你能”等等。。等等。另外,您要找的是一个
switch()
语句。很好。我有if($birth\u date>30&&in\u数组($birth\u month,数组(2,4,6,9,11)))