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 filter functions, with information extracted and condensed from w3schools.com and php.net.
It enables users to complete a quiz related to the PHP filter functions.
USAGE:
For each filter 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 filter 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
filter_has_var()
[filter_has_var – Checks if variable of specified type exists]
This function checks whether a variable of the specified type exists. Thus, it filters the variables that PHPhas access to.
filter_has_var(type, variable_name);
[Possible values for the type parameter: INPUT_GET; INPUT_POST; INPUT_COOKIE; INPUT_SERVER; and INPUT_ENV.]
filter_has_var(): returns TRUE on success; FALSE on failure.
filter_id()
[filter_id – Returns the filter ID belonging to a named filter]
This function returns the filter ID belonging to filtername.
filter_id(): integer representation of the ID of a filter on success; FALSE on failure.
filter_input_array()
[filter_input_array – Gets external variables and optionally filters them]
This function is handy for retrieving many values [an ‘array’ of values] without repetitively calling filter_input(). The definition parameter represents an array defining the arguments. A string containing a variable name is a valid key; a filter type, a filter constant, or an array optionally specifying the filter, flags, and options is a valid value. If the value is an array, valid keys are filter, flags, and options.
filter_input_array(type, definition[optional parameter], add_empty[optional parameter, with a default value of TRUE, that specifies whether missing keys should be added as NULL to the return value]);
[Possible values for the type parameter: INPUT_GET; INPUT_POST; INPUT_COOKIE; INPUT_SERVER; and INPUT_ENV.]
filter_input_array(): returns an array containing the requested variables’ values on success. If type is not populated, FALSE is returned if the FILTER_NULL_ON_FAILURE flag is set – otherwise, NULL is returned. An array value will be FALSE if the filter fails, or NULL if the variable is not set; however, these values will be inverted if the FILTER_NULL_ON_FAILURE flag is set. If add_empty is FALSE, no array element will be added for unset variables.
filter_input()
[filter_input – Gets a specific external variable by name and optionally filters it]
This function gets a specific external variable [i.e. an ‘input’] by name and optionally filters it. The optional filter parameter represents the ID of the filter to apply, whilst the optional options parameter represents an associative array of options or bitwise disjunction of flags. Flags can be provided in the ‘flags’ field if filter accepts options.
filter_input(type, variable_name, filter[optional parameter, with a default value of FILTER_DEFAULT – equivalent to FILTER_UNSAFE_RAW, resulting in no filtering taking place], options[optional parameter]);
[Possible values for the type parameter: FILTER_GET; FILTER_POST; FILTER_COOKIE; FILTER_SERVER; and FILTER_ENV.]
filter_input(): returns the value of the requested variable on success; FALSE if the filter fails, or NULL if variable_name is not set. If the FILTER_NULL_ON_FAILURE flag is used, it returns NULL on failure and FALSE if the variable is not set.
filter_list()
[filter_list – Returns a list of all supported filters]
This function returns a list of all supported filters.
filter_list();
filter_list(): returns an array of the names of all supported filters, or an empty array if there are no such filters. Use filter_id() on a named filter in order to return a filter ID.
filter_var_array()
[filter_var_array – Gets multiple variables and optionally filters them]
This function is used to retrieve many values [an ‘array’ of values] without having to repeatedly call filter_var().
filter_var_array(data_array, definition[optional parameter], add_empty[optional parameter, with a default value of TRUE]);
[data_array represents an array with string keys containing the data to filter. definition represents an array defining the arguments — a valid key is a string containing a variable name, and a valid value is either a filter type, an integer holding a filter constant, or an array optionally specifying the ‘filter’, ‘flags’, and ‘options’. add_empty specifies whether missing keys should be added as NULL to the return value.]
filter_var_array(): returns an array containing the values of the requested variables on success; FALSE on failure. An array value will be FALSE if the filter fails, or NULL if the variable is not set.
filter_var()
[filter_var – Filters a variable with a specified filter]
This function filters variable through filter. Scalar values are converted to string internally before they are filtered. If filter accepts options, flags can be provided in the ‘flags’ field of the options array.
filter_var(variable, filter[optional parameter with a default value of FILTER_DEFAULT], options[optional parameter]);
[options represents an associative array of options, or bitwise disjunction of flags. If the FILTER_CALLBACKfilter is used, callable type should be passed. The callback must accept one argument – the value to be filtered – and return the value after filtering/sanitizing it.]
filter_var(): returns the filtered data on success; FALSE if the filter fails.
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