When you are doing, for example, reports on months you need to know the last day of the month so you can calculate the needed timestamp (between the first and the last day).
As you know, for example, December has always 31 days, same for March and so on. Based on those facts a function can be easily written.
But why doing this? it seems PHP has a built-in function for it :)
// will return the last day of the current month print date('t'); // will return the last day of the month in which that timestamp is print date('t',TIMESTAMP);