_value ) ); // Bytes - Get the first number $bytes = '0'; preg_match( '/^([0-9\.]+)/', $checked_string, $matches ); if ( count( $matches ) == 2 ) { $bytes = $matches[1]; } // Unit - Get the first letter $unit = 'B'; preg_match( '/([KMGT]{1})/', $checked_string, $matches ); if ( count( $matches ) == 2 ) { $unit = $matches[1]; } return $bytes . $unit; } }