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:
An example of the layout designed for mobile phonesAn example of the layout designed for tabletsAn example of the layout designed for desktop computers
PURPOSE:
This webpage serves two purposes:
It provides a reference table for the PHP array functions, with information extracted and condensed from w3schools.com and php.net.
It enables users to complete a quiz related to the PHP array functions.
USAGE:
For each array 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 array 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.
Once the randomization of function descriptions, function syntaxes, and function return values has taken place, an ‘AUTO COMPLETE‘ button will appear above a button that facilitates a ‘RETURN TO VIEWPORT SELECTION‘. Clicking the ‘AUTO COMPLETE‘ button initiates a ‘self-completing quiz’ effect: the table cells will be correctly rearranged before your eyes in real-time. This ‘self-completion in real-time’ lasts approximately one-and-a-half minutes. You can rearrange the cells in any order that you like before clicking the ‘AUTO COMPLETE‘ button – the quiz will still ‘complete itself’.
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
array_walk_recursive()
[Apply a user function recursively to every member of an array]
Applies callback_function to each element of array. This function will recurse into deeper arrays.
[If specified, userdata will be passed as the third parameter (after value and key) to callback_function. Passing value as a reference (by prefixing ‘$value’ with an ampersand – ‘&$value’) allows the original value to be altered. Any key that holds an array will not be passed to the function.]
array_walk_recursive(): returns TRUE on success or FALSE on failure.
array_walk()
[Apply a user-supplied function to every member of an array]
Applies the user-supplied callback_function to every member of array. The function will walk through the entire array regardless of the position of the internal pointer. Since PHP 7.1.0, an ArgumentCountError will be thrown if callback_function requires more than two parameters [the value and key of the array member]. Previously, an E-WARNING-level error would be emitted each time callback_function was called.
[If specified, userdata will be passed as the third parameter (after value and key) to callback_function. Passing value as a reference (by prefixing ‘$value’ with an ampersand – ‘&$value’) allows the original value to be altered.]
array_walk(): returns TRUE on success or FALSE on failure.
arsort()
[Sort an array in reverse order and maintain index association]
Sorts associative_array in reverse order, according to the value. Array indices maintain their correlation with the array elements they are associated with. If two members compare as equal, their relative order in the sorted array is undefined.
[sort_flags can have the following values: SORT_REGULAR; SORT_NUMERIC; SORT_STRING; SORT_LOCALE_STRING; SORT_NATURAL; and SORT_FLAG_CASE.]
arsort(): returns TRUE on success or FALSE on failure.
asort()
[Sort an array and maintain index association]
Sorts associative_array in ascending order, according to the value. Array indices maintain their correlation with the array elements they are associated with. If two members compare as equal, their relative order in the sorted array is undefined.
[sort_flags can have the following values: SORT_REGULAR; SORT_NUMERIC; SORT_STRING; SORT_LOCALE_STRING; SORT_NATURAL; and SORT_FLAG_CASE.]
asort(): returns TRUE on success or FALSE on failure.
compact()
[Create array containing variables and their values]
Compact() does the opposite of extract() – in the output array, the variable name becomes the key and the variable contents becomes the value for that key. Any strings that are not set will simply be skipped.
[compact() takes a variable number of parameters, each of which can be either a string containing a variable name or an array of variable names. The array can contain other arrays of variable names inside it; compact() handles it recursively.]
Returns the ‘compact-ed’ output array with all the variables added to it.
count()
[Count all elements in an array, or something in an object]
Counts all elements in an array, or something in an object. Regarding objects, if you have ‘SPL’ installed, you can hook into count() by implementing interface Countable. Alias of sizeof().
count(array_or_countable [an array or countable object], count_mode... [optional parameter]);
[count_mode can be set to COUNT_RECURSIVE (or 1), facilitating a recursive count of the array.]
Counts and returns the number of elements in array_or_countable. When the parameter is neither an array nor an object implementing the Countable interface, 1 will be returned. If array_or_countable is NULL, 0 will be returned.
FILL IN FORM AND CLICK SUBMIT TO ADD YOUR STATISTICS TO THE LEADERBOARD:
Forty-year-old father of three wonderful children [William, Seth, and Alyssa]. Works as an Assistant Technical Officer in the Sterile Services Department of Treliske Hospital, Cornwall. Enjoys jogging, web design, learning programming languages, and supporting Arsenal FC. Obtained a BA degree in English from the University of Bolton in 2008, and has continued to gain qualifications in a diverse range of subjects thereafter.