Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function dltest ($filename=NULL) {
- Global $dltime_min,$dltime_sec;
- // $filesize = (filesize($filename)/1024);
- $filesize = 120012304 / 1024;
- $speeds = Array( 0.05,0.1,0.2,0.3,0.5,0.75,0.9,1,1.5,2,5,10,20); // MBps
- echo "Filesize: {$filesize} MB<br />The download will take:<br /> ";
- foreach($speeds as $kb){
- $kb *= 1024;
- $calc = $filesize/$kb;
- $dltime_min = round($calc / 60, 0);
- $dltime_sec = round($calc % 60, 0);
- if($kb > 1024){
- $unit = 'MBps';
- $kb /= 1024;
- }else{
- $unit = 'KBps';
- }
- echo $dltime_min . " minutes and " . $dltime_sec . " seconds. @ {$kb} {$unit}<br />";
- }
- }
- dltest();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment