CTphpnwb, on 5 Mar, 2009 - 11:38 AM, said:
Heh, since we're giving the answers away:
You don't need if statements or functions for a basic math problem.
You don't need if statements or functions for a basic math problem.
<?php $seconds = 90050; $day = 3600*24; $hour = 3600; $minute = 60; $d = $seconds/$day; $days = (int)$d; $seconds -= $days * $day; $h = ($seconds/$hour); $hours = (int)$h; $seconds -= $hours * $hour; $m = $seconds/$minute; $minutes = (int)$m; $seconds -= $minutes * $minute; echo $days." day(s) ".$hours." hours ".$minutes." minutes ".$seconds." seconds"; ?>
That just works exactly as I want !
But still get the code, and don't understand what some functions does !
I can try to know it, but I would like to get it from you guys like I got the idea of simplfying my code and make it simple !
so the issues are:
the operator -= ??
and int($var) !
what they actually do during this conversion ?
sorry for bothering !

New Topic/Question
Reply





MultiQuote





|