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 directory functions, with information extracted and condensed from w3schools.com and php.net.
- It enables users to complete a quiz related to the PHP directory functions.
USAGE:
For each directory 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 directory 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 |
|---|---|---|---|
chdir()
[chdir – Change directory] |
This function changes PHP’s current directory to directory. | chdir(directory);
[When |
chdir(): returns TRUE on success; FALSE and an E_WARNING-level error on failure. |
chroot()
[chroot – Change the root directory] |
This function changes the root directory of the current process to directory; the current working directory is changed to “/”. | chroot(directory);
[Root privileges are required for this function, and it is only available when using the CLI, CGI or Embed SAPI on GNU and BSD systems.] |
chroot(): returns TRUE on success; FALSE on failure. |
closedir()
[closedir – Close directory handle] |
This function closes the directory referred to by dir_handle. The stream must have been previously opened by opendir(). |
closedir(dir_handle [optional parameter]);
[If dir_handle is not specified, the last link opened by |
closedir(): no value is returned [void]. |
dir()
[dir – Return an instance of the Directory class] |
This function provides a pseudo-object oriented mechanism for reading a directory. The given directory is opened. | dir(directory, context [optional parameter]);
[ |
dir(): returns an instance of DIRECTORY on success; NULL with wrong parameters/FALSE in case of another error. |
getcwd()
[getcwd – Gets the current working directory] |
This function gets the current working directory. | getcwd();
[This function will return FALSE on some Unix variants if any one of the parent directories does not have the readable or search mode set, even if the current directory does.] |
getcwd(): returns the current working directory on success; FALSE on failure. |
opendir()
[opendir – Open directory handle] |
This function opens up a directory handle for use in subsequent readdir(), rewinddir(), and closedir() calls. |
opendir(path, context [optional parameter]);
[If path is not a valid directory – or the directory cannot be opened owing to filesystem errors or permission restrictions – |
opendir(): returns a directory handle resource on success; FALSE on failure. Error output can be suppressed by prefixing the function name with the ‘@‘ character. |
readdir()
[readdir – Read entry from directory handle] |
This function returns the name of the next entry in the directory [thus, this function ‘reads’ the given directory]. The order in which the entries are stored by the filesystem is the order in which they will be returned. | readdir(dir_handle [optional parameter]);
[dir_handle specifies the directory handle resource previously opened with |
readdir(): returns the entry name as a string on success; FALSE on failure. As with dir(), the === operator should be used to test the return value of this function. |
rewinddir()
[rewinddir – Rewind directory handle] |
This function resets the directory stream referenced by dir_handle to the beginning of the directory [thus, it ‘rewinds’ the directory stream]. | rewinddir(dir_handle [optional parameter]); |
rewinddir(): returns NULL on success; FALSE on failure. |
scandir()
[scandir – List files and directories inside the specified path] |
This function returns an array of files and directories from directory [thus, it ‘scans’ directory]. | scandir(directory, sorting_order [optional parameter with a default value of SCANDIR_SORT_ASCENDING], context [optional parameter]);
[possible values for sorting_order: SCANDIR_SORT_ASCENDING; SCANDIR_SORT_DESCENDING; SCANDIR_SORT_NONE.] |
scandir(): returns an array of filenames on success; FALSE on failure. Boolean FALSE is returned and an E-WARNING-level error is emitted if directory is not a directory. |

