public function abbrBytes(string $string): int
    {
        if (!preg_match('/^(?<value>[0-9\.]+)\s*(?<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/ui', $string, $_m)) {
            return 0; // Default value of `0`, failure.
        }
        $value    = (float) $_m['value'];
        $modifier = mb_strtolower($_m['modifier']);
        // unset($_m); // Housekeeping.

        switch ($modifier) {
            case 't':
            case 'tb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'g':
            case 'gb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'm':
            case 'mb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'k':
            case 'kb':
            case 'kbs':
                $value *= 1024;
        }
        return (int) $value;
    }
public function abbrBytes(string $string): int
    {
        if (!preg_match('/^(?<value>[0-9\.]+)\s*(?<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/ui', $string, $_m)) {
            return 0; // Default value of `0`, failure.
        }
        $value    = (float) $_m['value'];
        $modifier = mb_strtolower($_m['modifier']);
        // unset($_m); // Housekeeping.

        switch ($modifier) {
            case 't':
            case 'tb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'g':
            case 'gb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'm':
            case 'mb':
                $value *= 1024;
                // Fall through.
                // no break
            case 'k':
            case 'kb':
            case 'kbs':
                $value *= 1024;
        }
        return (int) $value;
    }
public function abbrBytes ( string $ string ) : int { if ( ! preg_match ( '/^(?<value>[0-9\.]+)\s*(?<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/ui' , $ string , $ _m ) ) { return 0 ; // Default value of `0`, failure. } $ value = ( float ) $ _m [ 'value' ] ; $ modifier = mb_strtolower ( $ _m [ 'modifier' ] ) ; // unset($_m); // Housekeeping. switch ( $ modifier ) { case 't' : case 'tb' : $ value *= 1024 ; // Fall through. // no break case 'g' : case 'gb' : $ value *= 1024 ; // Fall through. // no break case 'm' : case 'mb' : $ value *= 1024 ; // Fall through. // no break case 'k' : case 'kb' : case 'kbs' : $ value *= 1024 ; } return ( int ) $ value ; }
Bytes represented by notation.

@since 150424 Initial release.
@since 170824.30708 Returns `int` instead of `float`.

@param string $string A string byte notation.

@return int Bytes represented by notation.
Bytes represented by notation .