convert byte to megabyte php
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
// Uncomment one of the following alternatives
// $bytes /= pow(1024, $pow);
// $bytes /= (1 << (10 * $pow));
return round($bytes, $precision) . ' ' . $units[$pow];
}
Also in PHP:
- Number of week days between two dates in php
- add days with dates php
- check if substring in php
- List of php frameworks
- fget length of string php
- Uncaught RedisException: Redis server went away in
- add days in current date php
- apt install php7.4-mbstring php7.4-zip php7.4-xml
- Laravel 8 Auth Scaffolding using Inertia Jetstream
- The "App\Entity\ entity has a repositoryClass set to but this is not a valid class.
- add more data to variable php
- delete file using php
- $time = date('r') php
- convert base64 to file php
- create new projec in laravel
- date php w3schools
- eloquent seeds down
- date to string php
- disab;e error reporting php
- do_shortcode not working
- equivalent console.log in php
- count characters in string php
- disable updated_at laravel
- encode image to base64