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 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.
| FUNCTION NAME | FUNCTION DESCRIPTION | FUNCTION SYNTAX | FUNCTION RETURN VALUE |
|---|---|---|---|
get_browser()
[get_browser – Tells what the user’s browser is capable of] |
This function attempts to determine the capabilities of the user’s browser, by referencing [‘getting’] the browser’s information in the browscap.ini file (this file is not bundled with PHP but can be downloaded separately). |
get_browser(user_agent [optional parameter], return_array [optional parameter, with a default value of FALSE]);
[By default, the value of the HTTP User-Agent header is used for the user_agent parameter; this can be altered, or bypassed entirely by passing in NULL. If return_array is set to TRUE, this function will return an array instead of an object.] |
get_browser(): returns an object or an array containing various data elements pertaining to the browser – major and minor version numbers, ID string, TRUE/FALSE values for browser capabilities such as frames, JavaScript, cookies. |
__halt_compiler()
[__halt_compiler – Halts the compiler execution] |
This function halts the execution of the compiler, and can only be used from the outermost scope. It is useful for embedding data in PHP scripts, like the installation files. If halt_compiler() is present in a file, byte position of the data start can be determined by the __COMPILER_HALT_OFFSET__ constant. |
__halt_compiler(); |
__halt_compiler(): no value is returned [‘VOID’]. |
highlight_file()
[highlight_file – Syntax highlighting of a file] |
This function – an alias of show_source() – prints out or returns a syntax-highlighted version of the code contained in filename, using the colours defined in the built-in syntax-highlighter for PHP. Many servers are configured to highlight files with a phps extension automatically. |
highlight_file(filename, return [optional boolean parameter, with a default value of FALSE]);
[filename represents the path to the PHP file to be highlighted. return: when set to TRUE, this parameter makes the function return the highlighted code rather than printing it out; internal output buffering is then used, so this function cannot be used inside an |
highlight_file(): if return is set to TRUE, this function returns the highlighted code as a string rather than printing it out. Otherwise, TRUE is returned on success; FALSE on failure. |
highlight_string()
[highlight_string – Syntax highlighting of a string] |
This function outputs or returns html markup for a syntax-highlighted version of the given PHP code string, using the colours defined in the built-in syntax highlighter for PHP. |
highlight_string(string, return [optional boolean parameter, with a default value of FALSE]);
[string specifies the PHP code to be highlighted; the opening tag should be included. return: if set to TRUE, the function returns the highlighted code rather than printing it out.] |
highlight_string(): if return is set to TRUE, the highlighted code is returned as a string rather than being printed out. Otherwise, TRUE is returned on success; FALSE on failure. |
hrtime()
[hrtime – Get the system’s high resolution time] |
This function returns the system’s high resolution time, counted from an arbitrary point in time. The timestamp returned by this function cannot be either increased or decreased. | hrtime(get_as_number [optional boolean parameter, with a default value of FALSE]);
[get_as_number specifies whether the high resolution time should be returned in array or number format.] |
hrtime(): if get_as_number is FALSE then an array of integers in the form [seconds, nanoseconds] is returned. Otherwise, the nanoseconds are returned as integer [64-bit systems] or float [32-bit systems]. |
ignore_user_abort()
[ignore_user_abort – Set whether a client disconnect should abort script execution] |
This function sets whether a client [‘user’] disconnect should abort script execution. If value is set to TRUE then script execution continues regardless of a client disconnect; thus, the script ignores the disconnection. Similarly, if a script’s tty [‘teletype’/terminal] goes away without the script being terminated, a TRUE value stops the script from dying the next time it tries to write anything. | ignore_user_abort(value [optional boolean parameter, with no default value]);
[If given, value sets the ignore_user_abort PHP ini setting to the given value. If value is not set, this function simply returns the previous setting without changing it.] |
ignore_user_abort(): returns the previous setting, as an integer. |
pack()
[pack – Pack data into binary string] |
This function packs the given arguments into a binary string according to format. Perl provided the inspiration for this function; all formatting codes work the same as in Perl, although some – like “u” – are missing. Only unpack() – pack()‘s functional antagonist – is affected by the distinction between signed and unsigned values; pack() gives the same result for signed and unsigned format codes. PHP internally stores integers as signed values of a machine-dependent size; operations and literals that yield numbers outside the boundaries of the integer type will be stored as float. When these floats are packed as integers, they are first cast to the integer type — this may or may not result in the desired byte sequence. |
pack(format, arguments [optional parameter]);
[There are currently thirty implemented format codes: a (NUL-padded string); A (SPACE-padded string); h (hex string, low nibble first); H (hex string, high nibble first); c (signed char); C (unsigned char); s (signed short, 16-bit, machine byte order); S (unsigned short, 16-bit, machine byte order); n (unsigned short, 16-bit, big endian byte order); v (unsigned short, 16-bit, little endian byte order); i (signed integer); I (unsigned integer); l (signed long, 32-bit, machine byte order); L (unsigned long, 32-bit, machine byte order); N (unsigned long, 32-bit, big endian byte order); V (unsigned long, 32-bit, little endian byte order); q (signed long long, 64-bit, machine byte order); Q (unsigned long long, 64-bit, machine byte order); J (unsigned long long, 64-bit, big endian byte order); P (unsigned long long, 64-bit, little endian byte order); f (float); g (float, little endian byte order); G (float, big endian byte order); d (double); e (double, little endian byte order); E (double, big endian byte order); x (NUL byte); X (Back up one byte); Z (NUL-padded string); and @ (NUL-fill to absolute position).] |
pack(): returns a binary string containing data. |

