make love not war
by дядь Саша · Published · Updated
function bytes($s) { $units = 'KMGT'; return pow(1024, strpos($units, strpbrk($s, $units)) + 1) * (int) $s; } // usage: echo bytes('1K'); // 1024 echo bytes('1M'); // 1048576 |
function bytes($s) { $units = ‘KMGT’; return pow(1024, strpos($units, strpbrk($s, $units)) + 1) * (int) $s; } // usage: echo bytes(‘1K’); // 1024 echo bytes(‘1M’); // 1048576
дядь Саша
hardcore javascript & php programmer, passionate reverse engineer