> OK...I wrote this...is this what you want?
>
>
> return english_time("64925149");
>
> function english_time($minutes)
> {
> while ($minutes>=525600) {$years++;$minutes-=525600;}
> while ($minutes>=1440) {$days++;$minutes-=1440;}
> while ($minutes>=60) {$hours++;$minutes-=60;}
> if ($years) { $string[] = ( $years == 1) ? "1 year" : "$years years"; }
> if ($days) { $string[] = ( $days == 1) ? "1 day" : "$days days"; }
> if ($hours) { $string[] = ( $hours == 1) ? "1 hour" : "$hours hours"; }
> if ($minutes) { $string[] = ( $minutes == 1) ? "1 minute" : "$minutes
> minutes"; }
> return implode(", ",$string);
> }

I wrote a solution to the same problem, available at
http://www.phpcoded.com/?DO=viewCode&ID=88

I do believe that my solution is more efficent, considering that I use
modulus.

   Jome



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to