I have a script that has the file size as a value say for instance: $filesize I would like to display the download times for various connections by using the value $filesize. Do you have a snippet of code for this etc? Thanks in advance.
<?php function downloadTime( $size_of_file_in_bytes, $download_kilobytes_per_second ) { $seconds = $size_of_file_in_bytes / ( $download_kilobytes_per_second * 1024 ); $minutes = floor( $seconds / 60 ); $seconds = $seconds % 60; return array( 'minutes' => $minutes, 'seconds' => $seconds ); } list( $minutes, $seconds ) = array_values( downloadTime(10489999, 2048) ); echo $minutes . ' minutes ' . $seconds . ' seconds.'; PHP: