Re: Will this work right?
| From: | Ben Houlton | Date: | Sat, 14 Jun 2003 08:28:19 +0000 |
| Subject: | Re: Will this work right? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151466@lists.php.net to get a copy of this message | ||
Total newb question... lol, but how do I get this to work with a form...
lol, very embarasing to ask this...
"Leif K-Brooks" <eurleif@buyer-brokerage.com> wrote in message
news:3EEA3360.9000903@buyer-brokerage.com...
> The following function converts minutes to years, monthes, weeks, days,
> hours, minutes. For instance, 61 minutes would become "1 hour, one
> minute". Before I use it, I want to make sure there are no stupid
> mistakes. I can't find any, can any of you?
> function min2ymwdhm($min){
> $a = array();
> $years = intval(intval($min) / 525600);
> if($years > 0) $array[] = $years . ' year' . ($years == 1 ? '' :
> 's');
> $monthes = intval(intval($min) / 43200) % 12;
> if($monthes > 0) $array[] = $monthes . ' month' . ($monthes == 1 ?
> '' : 'es');
> $weeks = intval(intval($min) / 10080) % 4;
> if($weeks > 0) $array[] = $weeks . ' week' . ($weeks == 1 ? '' :
> 's');
> $days = intval(intval($min) / 1440) % 7;
> if($days > 0) $array[] = $days . ' day' . ($days == 1 ? '' :
> 's');
> $hours = intval(intval($min) / 60) % 24;
> if($hours > 0) $array[] = $hours . ' hour' . ($hours == 1 ? '' :
> 's');
> $minutes = intval($min) % 60;
> if($minutes > 0) $array[] = $minutes . ' minute' . ($minutes == 1 ?
> '' : 's');
> return implode($array,', ');
> }
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>