-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.php
59 lines (47 loc) · 1.2 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
print_r ( ShowMeTheMoney(123.85));
function ShowMeTheMoney($amount){
// if($amount%50>0) ;
if($amount>50){
$bills['50']= ($amount-($amount%50))/50;
$amount = $amount - ($bills[50]*50);
}
if($amount>20){
$bills['20']= ($amount-($amount%20))/20;
$amount = $amount - ($bills[20]*20);
}
if($amount>10){
$bills['10']= ($amount-($amount%10))/10;
$amount = $amount - ($bills[10]*10);
}
if($amount>5){
$bills['5']= ($amount-($amount%5))/5;
$amount = $amount - ($bills[5]*5);
}
if($amount>2){
$bills['2']= ($amount-($amount%2))/2;
$amount = $amount - ($bills[2]*2);
}
if($amount>1){
$bills['1']= ($amount-($amount%1))/1;
$amount = $amount - ($bills[1]);
}
if($amount>0.50){
$bills['0.50']= ($amount-($amount%0.50))/0.50;
$amount = $amount - ($bills['0.50']);
}
if($amount>0.20){
$bills['0.20']= ($amount-($amount%0.20))/0.20;
$amount = $amount - ($bills['0.20']);
}
if($amount>0.1){
$bills['0.1']= ($amount-($amount%0.1))/0.1;
$amount = $amount - ($bills['0.10']);
}
if($amount>0.05){
$bills['0.05']= ($amount-($amount%0.050))/50;
$amount = $amount - ($bills['0.05']);
}
return $bills;
}
?>