in reply to Perl from PHP

Check out Time::Local. This does the opposite of localtime, so you can get the day of week, etc.
use Time::Local; my $time = timelocal($sec,$min,$hour,$mday,$mon,$year); my @time_array = localtime($time);
As for
date("t", mktime(0,0,0,$month,1,$year));
I think you may have to just make an array with the last days of every month and use $lastdays[$mon] to get that day. I'm not aware of a perl function that will do that.