Convert a size string like 128M into bytes in PHP

function shop_to_bytes($value)
{
    $bytes = (int) $value;

    // no breaks: each unit falls through the smaller ones
    switch (strtolower(substr(trim($value), -1))) {
        case 'g': $bytes *= 1024;
        case 'm': $bytes *= 1024;
        case 'k': $bytes *= 1024;
    }

    return $bytes;   // shop_to_bytes(ini_get('memory_limit'))
}