Php questionnaire survey result statistics

Source: Internet
Author: User
When a new product is put into the market, you must first conduct a questionnaire survey to check the market demand of this product. This article will mainly introduce the statistics on the results of the php questionnaire survey. Background:

For specific work, I made A paper questionnaire. The main content of the questionnaire is to allow users to request items (numbered A, B ....) so the result I get is several hundred copies, similar to A> I> H> G> D .....

Objectives:

This requirement is quantified based on the user's sorting result. The final result is A:, B:, C :....., to find out which element is relatively important, while others are relatively unimportant.

Practice:

Based on the ranking of numbers, assign different weights, calculate all results, and summarize these weights. For example, the result of "ABCDEFGHIJ" indicates that A is scored, J is scored, and D is scored.

Knowledge Point:

File reading, loop, associated array, and array sorting.

Php code:

$ Rs = array ("A" =>, "B" =>, "C" =>, "D" =>, "E" =>, "F" =>, "G" =>, "H" =>, "I" =>, "J" =>); $ handle = fopen ('. /file.txt ', 'r'); while (! Feof ($ handle) {$ string = fgets ($ handle,); for ($ I =; $ I
 
  

Note: file.txt is a text file with each row representing the result of a questionnaire, similar to "ABCDEFGHIJ. How can this file be obtained? Okay, I admit that I did not manually enter the questionnaire. I have asked some help (why not do the online questionnaire? Saves the trouble)

The above content is the php questionnaire survey result statistics introduced in this article, and I hope to help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.