i 具有这一变量。
$productId = 2; // Testing ID
$value->id; // Contains INT
$value->datePurchaseEnd; // Contains UNIXTIME or NULL
The conditional i want to make.
if ($value->id == $productId) return true;
但是,如果NUL
,则该编码与目前时间比较,必须大于现在的返回代码<>。 TRUE
目前,这部法律是:
if( $value->id == $productId){
if( $value->datePurchaseEnd == NULL ){
$return = TRUE; break;
}else{
if( $value->datePurchaseEnd > mktime() ){
$return = TRUE; break;
}
}
}
But i feel this code is not good.
Is there any suggestion to make better code with conditional above?