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 filesystem functions, with information extracted and condensed from w3schools.com, phptutorial.info and php.net.
It enables users to complete a quiz related to the PHP filesystem functions.
USAGE:
For each filesystem 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 filesystem 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
fgets()
[fgets – Gets line from file pointer]
This function gets a line from file_pointer. Reading ends when length-1 bytes have been read, or a newline (included in the return value) is reached, or an EOF is encountered.
fgets(file_pointer, length [optional parameter – specifies a length in bytes]);
[Until PHP 4.3.0, omitting length would result in the function defaulting to a length of 1024 bytes. It is more efficient to specify the maximum line length if the majority of lines in the file are larger than 8KB.]
fgets(): returns a string of up to length-1 bytes read from the file pointed to by file_pointer. FALSE is returned if there is no more data to read in file_pointer, or if an error occurs.
fgetss()
[fgetss – Gets line from file pointer and and strips HTML tags]
This function gets a line from file_pointer and strips any NUL bytes, HTML and PHP tags from the text that it reads. Relying on this function is strongly discouraged, since it has been deprecated as of PHP 7.3.0.
[allowable_tags can be used to specify tags that should NOT be stripped.]
fgetss(): returns a string of up to length-1 bytes read from the file pointed to by file_pointer, with all NUL bytes, HTML, and PHP code stripped. FALSE is returned if an error occurs.
file_exists()
[file_exists – Checks whether a file or directory exists]
This function checks whether the file or directory specified by filenameexists. The results of this function are cached.
file_exists(filename);
[On Windows, use //computername/share/filename or \\computername\share\filename to check files on network shares.]
file_exists(): returns TRUE if the file or directory specified by filename exists; FALSE otherwise. FALSE is returned for files that are inaccessible owing to safe mode restrictions; these files can still be included if they are located in safe_mode_include_dir. An E_WARNING is emitted upon failure.
file_get_contents()
[file_get_contents – Reads entire file into a string]
This function returns [‘gets’] the contents of the file specified by filename as a string, starting at offset up to maxlen bytes. urlencode() is needed in instances where you’re opening a URI with special characters (such as spaces).
file_get_contents(filename, use_include_path[optional parameter with a default value of FALSE], resource_context[optional parameter, skippable by NULL], offset[optional parameter with a default value of 0], maxlen[optional parameter]);
[offset specifies where reading starts on the original stream.
If negative, offset is counted from the end of the stream. Seeking(offset) is not supported with remote files; seeking works on the buffered stream. The default behaviour of maxlen is to read until end-of-file is reached.]
file_get_contents(): returns the read data on success; FALSE on failure. An E_WARNING-level error is generated if filename cannot be found, maxlen is less than 0, or if seeking to the specified offset fails.
file_put_contents()
[file_put_contents – Write data to a file]
This function writes [‘puts’] data [‘contents’] to filename; identical to calling fopen(), fwrite(), and fclose() successively to write data to a file. The file will be created if filename does not exist. Unless the FILE_APPEND flag is set, the existing file will be overwritten.
file_put_contents(filename, data, flags[optional parameter with a default value of 0], context[optional parameter]);
[data can be a string, array, or a stream resource. If a stream resource, the remaining buffer of data stream will be copied to the specified file. The value of flags can be any combination of the following flags, joined by the BINARY OR [|] operator: FILE_USE_INCLUDE_PATH; FILE_APPEND; LOCK_EX. context denotes a valid context resource created with stream_context_create().]
file_put_contents(): returns the number of bytes that were written to the file; FALSE on failure.
file()
[file – Reads entire file into an array]
Whereas file_get_contents() reads a file into a string, this function reads an entire file into an array.
file(filename, flags [optional parameter, default value of 0], context[optional parameter]);
[A URL can be used as filename if the fopen wrappers have been enabled. flags can be one or more of the following constants: FILE_USE_INCLUDE_PATH; FILE_IGNORE_NEW_LINES; and FILE_SKIP_EMPTY_LINES.]
file(): returns the file as an array; each element in the array corresponds to a line of the file, with the newline still attached [unless FILE_IGNORE_NEW_LINES] is set. FALSE is returned on failure. An E_WARNING-level error is emitted if the file does not exist.
fileatime()
[fileatime – Gets last access time of file]
This function returns the last access time of filename. The atime of a file changes whenever the data blocks of a file are being read; on filesystems with atime updates disabled, this function will be useless.
fileatime(filename);
fileatime(): returns the time that filename was last accessed as a Unix timestamp on success; FALSE and an E_WARNING on failure.
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.