public static function getMemoryLimit()
    {
        $iniVal = ini_get('memory_limit');
        $val = $iniVal !== ''
            ? $iniVal
            : ( version_compare(PHP_VERSION, '5.2.0', '>')
                ? '128M'
                : ( version_compare(PHP_VERSION, '5.2.0', '=')
                    ? '16M'
                    : '8M'
                )
            );
        return $val;
    }