PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function ff(int $size) : string { $units = ['b', 'Kb', 'Mb', 'Gb']; $unit = reset ($units); while ($size > 1024) { $size = intval($size/ 1024); $unit = next($units); } return $size . $unit; } echo ff(123456789);
Show:  
Copy Clear