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 date/time functions, with information extracted and condensed from w3schools.com and php.net.
- It enables users to complete a quiz related to the PHP date/time functions.
USAGE:
For each date/time 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 date/time 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 |
|---|---|---|---|
microtime()
[Return current Unix timestamp with microseconds] |
Returns the current Unix timestamp with microseconds. This function only works on operating systems that support the gettimeofday() system call. |
microtime(get_as_float [optional parameter, with a default value of false]); |
If get_as_float is false [default] then a string is returned in the form ‘msec sec‘, where sec is the number of seconds since the Unix Epoch and msec measures microseconds that have elapsed since sec. If get_as_float is true then a float is returned that represents the number of seconds since the Unix Epoch, accurate to the nearest microsecond. |
mktime()
[Get Unix timestamp for a date] |
Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer and represents the number of seconds between the Unix Epoch and the time specified. | mktime(hour, minute, second, month, day, year, is_dst);
[All the above parameters are optional. Default values: hour = |
mktime(): returns the Unix timestamp of the arguments given. If invalid arguments are given, FALSE is returned. |
strftime()
[Format a local time/date according to locale settings] |
Formats the time and/or date according to locale settings, based on format_string. Month, weekday names, and other language-dependent strings respect the current locale set with setlocale(). Conversion specifiers that are not supported by your C library will not be supported by strftime(). Furthermore, platforms that do not support negative timestamps will be limited to a date range that starts no earlier than the Unix Epoch. |
strftime(format_string, timestamp [optional parameter, with a default value of time()]);
[The maximum length of format_string is 1023 characters. Valid characters for this parameter are: %a [‘Sun’ — ‘Sat’]; %A [‘Sunday’ — ‘Saturday’]; %d [’01’ — ’31’]; %e [‘1′ — ’31’]; %j [‘001’ — ‘366’]; %u [‘1’ (Monday) — ‘7’ (Sunday)]; %w [‘0’ (Sunday) — ‘6’ (Saturday)]; %U [week number of year; Sunday as first day of the week]; %V [week number of year; Monday as start of week; first week has 4+ weekdays]; %W [numerical representation of the week of the year, starting with the first Monday as the first week]; %b [‘Jan’ — ‘Dec’]; %B [‘January’ — ‘December’]; %h [‘Jan’ — ‘Dec’; alias of %b]; %m [’01’ (January) — ’12’ (December)]; %C [2-digit representation of the century]; %g [2-digit representation of the year, according to ISO-8601:1988]; %G [4-digit representation of %g]; %y [2-digit representation of year]; %Y [4-digit representation of year]; %H [’00’ — ’23’]; %k [‘0′ — ’23’]; %I [’01’ — ’12’]; %l [‘1′ — ’12’]; %M [’00’ — ’59’]; %p [‘AM’ or ‘PM’]; %P [‘am’ or ‘pm’]; %r [same as |
Returns a string formatted according to format_string, using the given timestamp or the current local time if this parameter is not provided. Supplying unknown conversion specifiers on a Windows system results in 5 E_WARNING messages and a return value of FALSE. Other operating systems might not issue any E_WARNING messages and may output the specifiers unconverted. |
strptime()
[Parse a time/date generated with |
Returns an array with the date parsed. Month names, weekday names, and other language-dependent strings respect the current locale set with setlocale() [LC_TIME]. Internally, this function calls the strptime() function provided by the system’s C library, and does not produce consistent output across different operating systems; it is not even implemented on Windows platforms. The use of date_parse_from_format() is recommended from PHP 5.3.0+. |
strptime(date, format);
[date represents the string to parse (eg. returned from |
Returns an array on success, or FALSE on failure. The following elements are returned in the array: tm_sec [seconds after the minute — 0-61]; tm_min [minutes after the hour — 0-59]; tm_hour [hours since midnight — 0-23]; tm_mday [day of the month — 1-31]; tm_mon [months since January — 0-11]; tm_year [years since 1900]; tm_wday [days since Sunday — 0-6]; tm_yday [days since January 01 — 0-365]; and unparsed [the date part that was not recognized using the specified format]. |
strtotime()
[Parse about any English textual datetime description into a Unix timestamp] |
This function tries to parse the provided time string into a Unix timestamp, relative to the now timestamp or the current local time if now is not provided. Each parameter uses the default timezone unless a particular timezone is specified in that parameter. | strtotime(time, now [optional parameter, with a default value of time()]); |
strtotime(): returns a timestamp on success, or FALSE on failure. Prior to PHP 5.1.0 this function would return -1 on failure. |
time()
[Return current Unix timestamp] |
Returns the time in the form of the number of seconds since the Unix Epoch. Since PHP 5.1 the timestamp of the start of the request is available in $_SERVER['REQUEST_TIME']. |
time(); |
time(): returns the number of seconds since the Unix Epoch. |
DateTimeZone::listAbbreviations()timezone_abbreviations_list()[Returns associative array containing dst, offset and the timezone name] |
This function returns an associative array containing dst, offset, and the timezone name. | Object-oriented:DateTimeZone::listAbbreviations();Procedural style: timezone_abbreviations_list(); |
Returns an associative array containing dst, offset, and the timezone name on success; FALSE on failure. |
DateTimeZone::listIdentifiers()timezone_identifiers_list()[Returns a numerically-indexed array containing all defined timezone identifiers] |
This function returns a numerically-indexed array containing all defined timezone identifiers. | Object-oriented:DateTimeZone::listIdentifiers(DateTimeZone_Constant [optional parameter, defaulting to DateTimeZone::ALL], country [optional parameter, defaulting to NULL]);
[country is only used when DateTimeZone::PER_COUNTRY is set as the DateTimeZone_Constant parameter. country represents a two-letter ISO 3166-1 compatible country code.] |
DateTimeZone::listIdentifiers(): returns a numerically-indexed array containing all defined timezone identifiers on success; FALSE on failure. |

