3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function formatBytes($bytes, $precision = 2) { $base = log($size) / log(1024); $suffixes = array('', 'k', 'M', 'G', 'T'); return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)]; } echo formatBytes(24962496);
based on 3Mggk
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: size in /in/AOsFT on line 4 NAN
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined index: -INF in /in/AOsFT on line 7 NAN
Output for 5.3.0 - 5.6.28
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined offset: -9223372036854775808 in /in/AOsFT on line 7 NAN
Output for 5.2.2 - 5.2.17
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined offset: -9223372036854775808 in /in/AOsFT on line 7 NAN
Output for 5.0.4 - 5.2.1
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined offset: -9223372036854775808 in /in/AOsFT on line 7 -NAN
Output for 4.3.4 - 5.0.3
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined offset: -9223372036854775808 in /in/AOsFT on line 7 -NAN
Output for 4.3.0 - 4.3.3
Notice: Undefined variable: size in /in/AOsFT on line 4 Notice: Undefined offset: 0 in /in/AOsFT on line 7 -NAN