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.
FUNCTION NAME
FUNCTION DESCRIPTION
FUNCTION SYNTAX
FUNCTION RETURN VALUE
sleep()
[sleep – Delay execution]
This function delays the program execution [makes the program ‘sleep’] for the given number of seconds.
sleep(seconds);
[seconds specifies the halt time in seconds.]
sleep(): returns zero on success; FALSE on error. If a signal interrupts the call, sleep() returns a non-zero value — on Windows, this value will be equal to the WAIT_IO_COMPLETION constant within the Windows API; on other platforms, the return value will be the number of seconds left to sleep. An E_WARNING is generated if the specified number of seconds is negative. Before PHP 5.3.4 on Windows, this function always returns NULL when sleep has occurred.
sys_getloadavg()
[sys_getloadavg – Gets system load average]
This function returns [‘gets’] three samples representing the average system load (the number of processes in the system run queue) over the last 1, 5, and 15 minutes.
sys_getloadavg();
sys_getloadavg(): returns an array of three samples [last 1, 5, and 15 minutes].
time_nanosleep()
[time_nanosleep – Delay for a number of seconds and nanoseconds]
This function delays program execution (makes the program execution ‘sleep’) for the period of time specified by seconds and nanoseconds.
time_nanosleep(seconds, nanoseconds);
[seconds must be a non-negative integer. nanoseconds must be a non-negative integer less than one billion.]
time_nanosleep(): returns TRUE on success; FALSE on failure. If the delay was interrupted by a signal, an associative array will be returned comprising seconds [number of seconds remaining in the delay] and nanoseconds [the number of nanoseconds remaining in the delay]. This function has been available on Windows systems since PHP 5.3.0.
time_sleep_until()
[time_sleep_until – Make the script sleep until the specified time]
This function makes the script sleep until the specified timestamp.
time_sleep_until(timestamp);
[timestamp specifies the timestamp at which the script should wake.]
time_sleep_until(): returns TRUE on success; FALSE on failure. This function has been available on Windows system since PHP 5.3.0. An E_WARNING is generated if timestamp is in the past.
uniqid()
[uniqid – Generate a unique ID]
This function returns an [optionally-prefixed] unique identifier based on the current time in microseconds. This function is not considered cryptographically-secure; for cryptographically-secure values it is advisable to use random_int(), random_bytes(), or openssl_random_pseudo_bytes(). Most systems adjust system clock by NTP; it is possible that this function does not return unique ID for the process/thread. The more_entropy parameter should be used to increase the likelihood of uniqueness.
[prefix is useful in cases where several identifiers might be generated simultaneously (at the same microsecond). If more_entropy is set to true, additional entropy – using the combined linear congruential generator – will be added at the end of the return value, increasing the likelihood of the result’s uniqueness.]
uniqid(): returns a timestamp-based unique identifier as a string. With an empty prefix, the returned string will be 13 characters long; if more_entropy is TRUE it will be 23 characters long.
unpack()
[unpack – Unpack data from binary string]
This function unpacks from a binary_string into an associative array, according to the specified format. To facilitate data storage in an associative array, the different format codes must be named and separated by a forward slash (/). If a repeater argument is present, each of the array keys will have a sequence number behind the given name.
unpack(format, binary_string, offset[optional parameter, with a default value of 0]);
[binary_string represents the packed data. offset represents the offset to start unpacking from.]
unpack(): returns an associative array containing unpacked elements of binary_string.
usleep()
[usleep – Delay execution in microseconds]
This function delays program execution [makes the program ‘sleep’] for the specified number of micro_[μ]seconds.
usleep(micro_seconds);
[micro_seconds specifies a halt time in microseconds (millionths of a second).]
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