Site icon sharedsapience.info

PHP LibXML Quiz: All LibXML Functions [2019]

The libxml_clear_errors PHP LibXML function, sized for tablet viewing.

An image of the libxml_clear_errors() PHP LibXML function, sized for tablet viewing.

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:

An example of the layout designed for mobile phones
An example of the layout designed for tablets
An example of the layout designed for desktop computers

PURPOSE:

This webpage serves two purposes:

  1. It provides a reference table for the PHP libxml functions, with information extracted and condensed from w3schools.com and php.net.
  2. It enables users to complete a quiz related to the PHP libxml functions.

USAGE:

For each libxml 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 libxml 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
libxml_clear_errors()

[libxml_clear_errors – Clear libxml error buffer]

This function clears the errors in the libxml error buffer. libxml_clear_errors(); libxml_clear_errors(): no value is returned [‘VOID’].
libxml_disable_entity_loader()

[libxml_disable_entity_loader – Disable the ability to load external entities]

This function enables/disables libxml extensions – such as DOM, XMLWriter and XMLReader – that serve as ‘loaders’ of external entities. libxml_disable_entity_loader(disable [optional parameter, with a default value of TRUE]); libxml_disable_entity_loader(): returns the previous value.
libxml_get_errors()

[libxml_get_errors – Retrieve array of errors]

This function retrieves [‘gets’] an array of errors from the libxml error buffer. libxml_get_errors(); libxml_get_errors(): returns an array of LibXMLError objects if there are any errors in the buffer; or an empty array otherwise.
libxml_get_last_error()

[libxml_get_last_error – Retrieve last error from libxml]

This function retrieves [‘gets’] the last error from libxml. libxml_get_last_error(); libxml_get_last_error(): returns a LibXMLError object if there is any error in the buffer; FALSE otherwise.
libxml_set_external_entity_loader()

[libxml_set_external_entity_loader – Changes the default external entity loader]

This function changes [‘sets’] the external entity loader for libxml. libxml_set_external_entity_loader(resolver_function);

[resolver_function is of type callable and accepts three arguments – public_id, system_id (two strings), and a context array comprising four keys. resolver_function should return a resource, a string from which a resource can be opened, or NULL.]

libxml_set_external_entity_loader(): returns TRUE on success; FALSE on failure.
libxml_set_streams_context()

[libxml_set_streams_context – Set the streams context for the next libxml document load or write]

This function defines [‘sets’] the streams context for the next libxml document load or write. libxml_set_streams_context(streams_context);

[streams_context represents the stream context resource, created with stream_context_create().]

libxml_set_streams_context(): no value is returned [‘VOID’].
libxml_use_internal_errors()

[libxml_use_internal_errors – Disable libxml errors and allow user to fetch error information as needed]

This function allows you to disable standard libxml errors and enable user error handling of any internal errors. libxml_use_internal_errors(use_errors [optional parameter, with a default value of FALSE]);

[use_errors specifies whether user error handling is enabled [TRUE] or disabled [FALSE]. Any existing libxml errors are cleared when user error handling is disabled.]

libxml_use_internal_errors(): returns the previous value of use_errors.

Web design certified by:
Click images for proof of certification.


Exit mobile version