需要制作自定义功能来检查可用面额的金额。我做的代码:
$amount = 100;
$notes_aval = array(20,50,100,500,2000);//available currency notes
$is_allowed = 0; //not allowed
foreach($notes_aval as $note){
if (fmod($amount,$note) == 0) {
$is_allowed = 1;//allowed
}
}
echo $is_allowed;
但这并不适用于所有情况。考试:我有面额 = array (20,50); 数量为 90 是不允许的,但应该允许 20*2 + 50*1 = 90
在面额 = array (20,50) 的示例中,如果金额 1110 应该可以接受,则 1110 = 20*53 + 50*1
胡说叔叔
猛跑小猪