Quantcast
Channel: PHP Archive
Viewing all articles
Browse latest Browse all 56

[PHP]数字に序数詞をつけて 1st, 2nd 3rd のように出力する

$
0
0
序数のルールは1の位が 1 であれば 1st、2 であれば 2nd、3 であれば 3rd となり、それ以外は th をつけます。 ただし、10の位が 1 の場合はすべて th がつきます。 特定の桁を取得する場合は剰余( … Continue reading

Viewing all articles
Browse latest Browse all 56