Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:php [01.12.2014 10:44] – msd-media | en:create:php [09.01.2015 12:41] – admin |
---|
===== Variables ===== | ===== Variables ===== |
| |
The word //function// derives from mathematics. Although the command ''question()'' has not much in common with functions. But other functions can actually compute things. For example, the command ''[[functions-random#random|random()]]'' computes a random number. | The word //function// derives from mathematics. Although the command ''question()'' has not much in common with functions. But other functions can actually compute things. For example, the command ''[[:en:create:functions:random|random()]]'' computes a random number. |
| |
The function ''random()'' expects two parameters: the smallest and the largest number that can be drawn. ''random(1,6)'' will draw a number between 1 and 6. We can use this number, e.g. to choose a stimulus randomly. | The function ''random()'' expects two parameters: the smallest and the largest number that can be drawn. ''random(1,6)'' will draw a number between 1 and 6. We can use this number, e.g. to choose a stimulus randomly. |
The equal sign (%%=%%) is an operator. In this case it makes sure, the output of the function ''random()'' is saved in the variable ''$number'' on the left. So the variable ''$number'' now contains a random number. | The equal sign (%%=%%) is an operator. In this case it makes sure, the output of the function ''random()'' is saved in the variable ''$number'' on the left. So the variable ''$number'' now contains a random number. |
| |
If we want to print the random number onto the screen, we need the command ''[[functions-output#html|html()]]''. This function does nothing else than to print HTML-code (which is, basically, text) into the questionnaire. | If we want to print the random number onto the screen, we need the command ''[[:en:create:functions:html|html()]]''. This function does nothing else than to print HTML-code (which is, basically, text) into the questionnaire. |
| |
<code php> | <code php> |
{{:en:create:scr.php.random-h1.png?nolink|Output formatted text}} | {{:en:create:scr.php.random-h1.png?nolink|Output formatted text}} |
| |
**Tip:** More detailed explanations about the function is given at ''[[functions-output#html|html()]]''. | **Tip:** More detailed explanations about the function is given at ''[[:en:create:functions:html|html()]]''. |
| |
===== List of available functions (references) ===== | ===== List of available functions (references) ===== |