PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function formatSize($size) { $types = ["B", "KB", "MB", "GB"]; while ($size / 1024 > 1 && next($types)) { $size = round(($size / 1024), 2); } return $size . " " . current($types); } echo formatSize(1024*1024*1024 * 4);
Show:  
Copy Clear