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 miscellaneous functions, with information extracted and condensed from w3schools.com and php.net.
It enables users to complete a quiz related to the PHP miscellaneous functions.
USAGE:
For each PHP miscellaneous 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 miscellaneous 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.
This function checks whether the client disconnected [‘aborted the connection’].
connection_aborted();
connection_aborted(): returns 1 if the client disconnected; 0 otherwise.
connection_status()
[connection_status – Returns connection status bitfield]
This function returns the connection statusbitfield.
connection_status();
connection_status(): returns the connection status bitfield – one of four possible values: 0 [CONNECTION_NORMAL]; 1 [CONNECTION_ABORTED]; 2 [CONNECTION_TIMEOUT]; or 3 [CONNECTION_ABORTED & CONNECTION_TIMEOUT].
constant()
[constant – Returns the value of a constant]
This function returns the value of the constant represented by name.
constant(name);
constant(): returns the value of the constant on success; FALSE and an E_WARNING-level error on failure.
define()
[define – Defines a named constant at runtime]
This function defines a named constant at runtime.
define(name, value, case_insensitive[optional parameter with a default value of FALSE]);
[name: it is not recommended – although it is possible – to define() constants with reserved or invalid names (whose values can only be retrieved through the use of the constant() function). value: in PHP 7 array values are accepted, in addition to the types accepted by PHP 5 (integer, float, string, boolean, and NULL). Resource constants can be defined, but this is not recommended since it can lead to unpredictable behaviour. case_insensitive: if set to TRUE the constant will be defined case-insensitively and stored in lowercase. Case-insensitive definitions are deprecated as of PHP 7.3.0.]
define(): returns TRUE on success; FALSE on failure.
defined()
[defined – Checks whether a given named constant exists]
This function checks whether the constant represented by name exists and is defined.
Since defined() only applies to constants, use isset() to check whether a variable exists, and function_exists() to ascertain the existence of a function.
defined(name);
defined(): returns TRUE if the named constant represented by name has been defined; FALSE otherwise.
eval()
[eval – Evaluate a string as PHP code]
This language constructevaluates the passed code as PHP code. As it facilitates the execution of arbitrary PHP code, its use is discouraged. Do not pass any user-provided data to it without correct prior validation.
eval(code);
[code represents valid PHP code to be evaluated. Opening and closing PHP tags must not be included. A return statement will immediately terminate evaluation of the code. code is executed in the scope of the code calling eval(); thus, any variables that are defined/altered during execution of the eval() call will persist after its termination.]
eval(): returns NULL unless return is called in the code — in which case, the value passed to return is returned. A ParseError exception is thrown if a parse error is encountered in the evaluated code in PHP 7; beforehand, FALSE would be returned and the ensuing code execution continued normally. Parse errors cannot be caught in eval() using set_error_handler(). A fatal error causes the whole script to exit.
exit()
[exit – Output a message and terminate the current script]
This language construct – equivalent to the die()language construct – terminates execution [thus, ‘exits’] the script. Even when exit() is called, shutdown functions and object destructors will always be executed. Since it is a language construct, exit can be called without parentheses if no status is passed.
exit(status[optional parameter]);
[If present, status can be either a string or an integer. If a string, exit() will print it just before exiting. If an integer it should be in the range 0 – 254; 255 is reserved by PHP, while 0 is used to terminate the script successfully.]
exit(): no value is 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.