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.