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', 'Kib', 'Mib', 'Gib']; $unit = reset ($units); while ($size >= 1024) { $size = intval($size/ 1024); $unit = next($units); } return $size . $unit; } echo ff(1024*1024); echo PHP_EOL; echo ff(1024**3);
Show:  
Copy Clear