Well, you already have your "array" there, just put it in code:
$ordinals = array(
1=>"first",
2=>"second",
// ...
);
Then you can access the array:
echo $ordinals[date("d")];
質問
Using PHP I want to show the day of the month in ordinal way like ::
1 first
2 second
3 third
4 fourth
5 fifth
6 sixth
7 seventh
8 eighth
9 ninth
10 tenth
11 eleventh
12 twelfth
13 thirteenth
14 fourteenth
15 fifteenth
16 sixteenth
17 seventeenth
18 eighteenth
19 nineteenth
20 twentieth
21 twenty-first
22 twenty-second
23 twenty-third
24 twenty-fourth
25 twenty-fifth
26 twenty-sixth
27 twenty-seventh
28 twenty-eighth
29 twenty-ninth
30 thirtieth
31 thirty-first
e.g. if date is 22-Feb it should show : twenty-second Feb
Thanks in advance....
解決
Well, you already have your "array" there, just put it in code:
$ordinals = array(
1=>"first",
2=>"second",
// ...
);
Then you can access the array:
echo $ordinals[date("d")];