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_search()
[Searches an array for a given value and returns the first corresponding key if successful]
Searchesarray for value. If value is a string, the comparison is done in a case-sensitive manner.
[strict specifies whether to search for identicalvalues in the array]
Searches for, and returns, the first key for value; if value is not present, NULL is returned.
array_shift()
[Shift an element off the beginning of array]
Shifts the first value of array off and returns it, shortening the array by one element and moving everything down. Numerical array keys will be modified to start counting from zero, while literal keys will remain untouched.
array_shift(array);
[This function rewinds array‘s internal pointer after use.]
Returns the shifted value on success; NULL if array is empty or is not an array.
array_slice()
[Extract a slice of the array]
Returns the sequence of elements [‘slice’] from array as specified by the offset and length parameters.
[If offset is non-negative, the sequence starts at offset in array; otherwise, the sequence starts that far from the end of array.
If length is positive, the sequence will have up to length elements in it. If array is shorter than length, only available array elements will be present. If length is negative, the sequence stops that many elements from the end of the array. If length is omitted, the sequence consists of everything from offset up until the end of array.
Setting preserve_keys to true stops the function from reordering and resetting the numeric array indices by default.]
Returns the specified array slice. An empty array is returned when offset is larger than the size of array.
array_splice()
[Remove a portion of the array and replace it with something else]
Removes the elements designated by offset and length from array, replacing them with the elements of replacement_array, if supplied [creating a spliced array]. Numeric keys in array are not preserved. If replacement_array is not an array it will be typecast to one.
[If offset is positive, the start of the removed portion is at offset from the beginning of array. If negative then it starts at that offset from the end of array.
Omitting length removes everything from offset to the end of array. If negative then the end of the removed portion will be that many elements from the end of array. If 0, no elements will be removed.
If replacement_array is specified, removed elements will be replaced by elements from this array. If offset and length are such that nothing is removed, elements from replacement_array are inserted in the place specified by offset. Keys in replacement_array are not preserved.]
Returns an array consisting of the extracted [‘spliced’] elements.
array_sum
[Calculate the sum of values in an array]
Returns the sum of values in an array.
array_sum(array);
Returns the sum of values as an integer or float, or zero if array is empty.
array_udiff_assoc()
[Computes the difference of arrays with additional index check, compares data by a callback function]
Computes the difference of arrays with additional index check, compares data by callback_function.
[callback_function must return an integer that is less than, equal to, or greater than 0 if the first argument is considered to be respectively less than, equal to, or greater than the second argument.]
array_udiff_assoc(): returns an array containing all the values in array1 that are not present in any of the comparison arguments. The comparison of arrays’ data is performed via a user-supplied callback_function.
array_udiff_uassoc()
[Computes the difference of arrays with additional index check, compares data and indexes by a callback function]
Computes the difference of arrays with additional index check, compares data and indexes by a callback_function [value_compare, key_compare].
[value_compare and key_compare must return an integer less than, equal to, or greater than zero, depending on whether the first argument is considered to be respectively less than, equal to, or greater than the second argument.]
array_udiff_uassoc(): returns an array of all the values in array1 that are not present in any subsequent array.
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.
Leave a Reply