public static function getMemoryLimitValue()
{
if (($memory = ini_get('memory_limit')) > 0) {
// handle shorthand byte options (case-insensitive)
$shorthandByteOption = substr($memory, -1);
switch ($shorthandByteOption) {
case 'G':
case 'g':
return substr($memory, 0, -1) * 1024;
case 'M':
case 'm':
return substr($memory, 0, -1);
case 'K':
case 'k':
return substr($memory, 0, -1) / 1024;
}
return $memory / 1048576;
}
// no memory limit
return false;
}