for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* tdmdownloads
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* @copyright Gregory Mage (Aka Mage)
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @author Gregory Mage (Aka Mage)
*/
* @param $val
* @return float|int
function tdmdownloadsReturnBytes($val)
{
switch (mb_substr($val, -1)) {
case 'K':
case 'k':
return (int)$val * 1024;
case 'M':
case 'm':
return (int)$val * 1048576;
case 'G':
case 'g':
return (int)$val * 1073741824;
default:
return $val;
}