/** * * @param int $time O tempo em segundos * @return string O tempo em forma textual */ function time2text($time){ $years = floor($time / (60*60*24*365)); $time-=$years*60*60*24*365; $months = floor($time/(60*60*24*30)); $time-=$months*60*60*24*30; $days = floor($time/(60*60*24)); $time-=$days*60*60*24; $hours = floor($time/(60*60)); $time-=$hours*60*60; $seconds = floor($time/60); return ($years>0?$years.' ano'. ($years>1?'s ':' '):'') . ($months>0?$months.' mes'.($months>1?'es ':' '):'') . ($days>0?$days.' dia' .($days>1?'s ':' '):'') . ($hours>0?$hours.' hora'.($hours>1?'s ':' '):'') . ($seconds>0?$seconds.' segundo' . ($seconds>1?'s ':' ') :''); }