HOW THE QUIZ WORKS:
Clicking the ‘randomize’ button situated above the reference table generates a new table whereby the function descriptions, function syntaxes, and function return values are randomized. The quiz involves matching the function descriptions, function syntaxes, and function return values to the correct function name. Information relating to the randomization of table cells will be displayed for three seconds, before disappearing.
On a desktop computer, table elements are selected by left-clicking the desired table cell and holding the left click in the mouse down position for one second before releasing the left click. The text inside the table cell will turn red to indicate that the one-second mouse left-click has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second left mouse-click process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second left mouse-click process on the original table cell.
To select a table element on a touchscreen device (mobile, tablet), simply touch the desired table cell and maintain the touch for one second before removing your finger from the screen. The text inside the table cell will turn red to indicate that the one-second touch has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second touch process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second touch process on the original table cell.
Normal touchscreen scrolling behaviour is exhibited by the cells with a light green background; cells without a light green background will not respond to normal touchscreen scrolling. The table is positioned in such a way that the user can also initiate touchscreen scrolling by swiping to the right or left of the table.
When a row consists of the correct function name, function description, function syntax, and function return value, the background colour of the row will change from ‘transparent’ to ‘khaki’; this provides visual feedback that the row is complete.
Once the entire table is complete, a paragraph of feedback will congratulate the user and provide the following information: date and time of quiz commencement; date and time of quiz completion; and the length of time it took the user to complete the quiz.
VIEWPORT OPTIONS:
PURPOSE:
This webpage serves two purposes:
- It provides a reference table for the PHP mathematical functions, with information extracted and condensed from w3schools.com and php.net.
- It enables users to complete a quiz related to the PHP mathematical functions.
USAGE:
For each mathematical function there are four table cells of information: the function name; the function description; the function syntax; and the function return value. There are three layouts available – ‘mobile‘, ‘tablet‘, and ‘desktop‘.
Click the relevant button below to display the PHP mathematical functions reference table, sized appropriately for the desired viewport. A ‘RANDOMIZE‘ button appears above the reference table once the viewport is selected; clicking this button facilitates the commencement of a quiz.
Click the ‘RANDOMIZE‘ button to randomize the functional descriptions, the functional syntaxes, and the functional return information.
| FUNCTION NAME | FUNCTION DESCRIPTION | FUNCTION SYNTAX | FUNCTION RETURN VALUE |
|---|---|---|---|
mt_rand()
[Generates a random number via the Mersenne Twister Random Number Generator] |
If called without the optional min and max arguments a pseudo random number between 0 and mt_getrandmax() is returned. Otherwise, a random number between min and max [inclusive] is returned.
As with |
mt_rand();
OR
|
Returns a random integer between min (or 0) and max (or mt_getrandmax(), inclusive), or FALSE if max is less than min. |
mt_srand()
[Seeds the Mersenne Twister Random Number Generator] |
mt_srand: Seeds the random number generator with seed (if specified), or with a random value if no seed is given. |
mt_srand(seed [optional], mode [optional]);
[seed specifies an arbitrary integer seed value; |
No value is returned for mt_srand(). |
octdec()
[Octal to decimal] |
Returns the decimal equivalent of the octal number represented by the octal_string argument. | octdec(octal_string); |
If the decimal equivalent of the octal_string argument can be represented by the platform’s integer type then an integer is returned; otherwise, a float representation is returned. |
pi()
[Gets the value of ‘pi’] |
Returns an approximation of pi, which has a default precision of 14 (can be altered in the php.ini file). Using the M_PI constant yields identical results to pi(). |
pi(); |
Returns a float representation of pi. |
pow()
[Exponential expression] |
Returns x raised to the power of y.
All input – even non-scalar values – will be converted to a number, which could produce unexpected results. |
pow(x, y);
[x specifies the ‘base’ to use; y specifies the ‘exponent’.] |
Returns x raised to the power of y. If both x and y are non-negative integers and the result can be represented as an integer, an integer type is returned; otherwise, a float type is returned. |
rad2deg()
[Converts the radian number to the equivalent number in degrees] |
This function converts number from radian to degrees. | rad2deg(number); |
Returns a float representation of number converted to degrees. |
rand()
[Generates a random integer] |
If called without the min, max arguments rand() returns a pseudo-random integer between 0 and getrandmax(). rand(5, 15) returns a number between 0 and 15 [inclusive], for example.
As with |
rand();
OR rand(min, max); |
Returns a pseudo random integer between min (or 0) and max (or getrandmax()), inclusive. |

