Given a size in KB, try to return a more readable MB, GB or TB answer string function readable_size_for_kb($mykb) { if ( $mykb > 1073741824 ) { return sprintf(“%5.1f TB”,$mykb / 1024 / 1024/1024); } elseif ( $mykb > 1048576 ) { return sprintf(“%5.1f GB”,$mykb / 1024 / 1024); } elseif ( $mykb > 1024 […]
Readable Time – PHP, given a UNIX timestamp, return a readable time # Given a unix timestamp, returns in readable time ie “1 day, 7 hours, 23 minutes, 2 seconds” function readable_time($timestamp, $num_times = 2) { //this returns human readable time when it was uploaded (array in seconds) $times = array(31536000 => ‘year’, 2592000 => […]