Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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]; 
} 
Comment

PREVIOUS NEXT
Code Example
Php :: php get tempfile 
Php :: wordpress post revisions config 
Php :: E: Unable to locate package php8.0 
Php :: Deleting an element from an array in PHP 
Php :: validate each value from array laravel 
Php :: php check if input is int 
Php :: wordpress is home page 
Php :: flutter network image svg 
Php :: password_hash 
Php :: php loop object 
Php :: laravel make view command 
Php :: dummy data in laravel 
Php :: validation error message in laravel 
Php :: wordpress get current taxonomy 
Php :: skip add to cart for woocommerce 
Php :: laravel route logout 
Php :: laravel error storage permission denied 
Php :: laravel drop table column 
Php :: cake php 2.x joins 
Php :: image storage storepublicy in laravel 
Php :: carbon equal dates 
Php :: php add array values with same keys 
Php :: format date in php 
Php :: ubuntu install php 8 nginx 
Php :: php array remove key value pair 
Php :: where is the php ini file located on server 
Php :: php auto redirect 
Php :: sanctum auth check? 
Php :: laravel custom log 
Php :: default value date symfony entity 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =