This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:create:points [02.04.2015 15:45] – oezbf2012 | en:create:points [23.03.2021 22:51] – sophia.schauer | ||
---|---|---|---|
Line 18: | Line 18: | ||
The simplest way of keeping score is for a quiz or a knowledge test. These have a range of selection questions and one of the options is correct for each one. | The simplest way of keeping score is for a quiz or a knowledge test. These have a range of selection questions and one of the options is correct for each one. | ||
- | The following PHP code initially defines which questions will be evaluated and what the correct response is. An [[: | + | The following PHP code initially defines which questions will be evaluated and what the correct response is. An [[: |
Line 26: | Line 26: | ||
<code php> | <code php> | ||
// Define questions and the correct answers | // Define questions and the correct answers | ||
- | $questions = array( | + | $questions = [ |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | // and so on. | + | // and so on |
- | ); | + | ]; |
// Initialize counter variable | // Initialize counter variable | ||
Line 48: | Line 48: | ||
} | } | ||
- | // Show result | + | // Show result |
html('< | html('< | ||
+ | // ... or store in an internal variable | ||
+ | put(' | ||
</ | </ | ||
Line 75: | Line 77: | ||
<code php> | <code php> | ||
// Define questions and the values of possible answers | // Define questions and the values of possible answers | ||
- | $questions = array( | + | $questions = [ |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
// u.s.w. | // u.s.w. | ||
- | ); | + | ]; |
// Initialize counter variable | // Initialize counter variable | ||
Line 156: | Line 158: | ||
<code php> | <code php> | ||
// List of items - providing polarity in each case | // List of items - providing polarity in each case | ||
- | $items = array( | + | $items = [ |
' | ' | ||
' | ' | ||
Line 163: | Line 165: | ||
' | ' | ||
// and so on. | // and so on. | ||
- | ); | + | ]; |
// Initialization of points variable | // Initialization of points variable | ||
Line 219: | Line 221: | ||
// Define questions and their correct answers | // Define questions and their correct answers | ||
// Only items are defined that will also be checked | // Only items are defined that will also be checked | ||
- | $questions = array( | + | $questions = [ |
// In question AB01, 1 and 2 have to be checked, 3 and 4 must not be checked | // In question AB01, 1 and 2 have to be checked, 3 and 4 must not be checked | ||
- | ' | + | ' |
// In question AB02, 2 and 3 have to be checked, 4 must not, and the value for 1 is irrelevant | // In question AB02, 2 and 3 have to be checked, 4 must not, and the value for 1 is irrelevant | ||
- | ' | + | ' |
// In AB03, all 4 have to be checked | // In AB03, all 4 have to be checked | ||
- | ' | + | ' |
// and so on. | // and so on. | ||
- | ' | + | ' |
- | ' | + | ' |
- | ); | + | ]; |
// Initialize counter variable | // Initialize counter variable |