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
Click here to cancel reply.
Notify me of follow-up comments by email.
Notify me of new posts by email.