function get_suffix($number) ( $last_number = substr($number,-1); //fetch the last number if($last_number == "0" || $last_number == 0)( $last_number = 4; ) // if last number is 0 than it assign value 4 return date("S",mktime(0,0,0,1,$last_number,2009)); )
Menampilkan sufiks angka apa pun:
1 = st
2 = nd
3 = rd
4 = th
50 = th
Contoh: Ini adalah cuplikan terkeren ke-23 yang pernah ada.
Tanggal pengembalian bulan dengan akhiran yang sesuai
function day_of_month( ) ( $number = date( 'j' ); if ( $number(( strlen( $number ) - 1 )) == 1 ) ( $suffix = "st"; ) elseif ( $number(( strlen( $number ) - 1 )) == 2 ) ( $suffix = "nd"; ) elseif ( $number(( strlen( $number ) - 1 )) == 3 ) ( $suffix = "rd"; ) else ( $suffix = "th"; ) return array( "number" => $number, "suffix" => $suffix ); )