Moodle  2.2.1
http://www.collinsharper.com
question_utils Class Reference

Static Public Member Functions

static arrays_have_same_keys_and_values (array $array1, array $array2)
static arrays_same_at_key (array $array1, array $array2, $key)
static arrays_same_at_key_missing_is_blank (array $array1, array $array2, $key)
static arrays_same_at_key_integer (array $array1, array $array2, $key)
static int_to_roman ($number)

Detailed Description

Useful functions for writing question types and behaviours.

Definition at line 675 of file lib.php.


Member Function Documentation

static arrays_have_same_keys_and_values ( array array1,
array array2 
) [static]

Tests to see whether two arrays have the same keys, with the same values (as compared by ===) for each key. However, the order of the arrays does not have to be the same.

Parameters:
array$array1the first array.
array$array2the second array.
Returns:
bool whether the two arrays have the same keys with the same corresponding values.

Definition at line 685 of file lib.php.

Here is the caller graph for this function:

static arrays_same_at_key ( array array1,
array array2,
key 
) [static]

Tests to see whether two arrays have the same value at a particular key. This method will return true if: 1. Neither array contains the key; or 2. Both arrays contain the key, and the corresponding values compare identical when cast to strings and compared with ===.

Parameters:
array$array1the first array.
array$array2the second array.
string$keyan array key.
Returns:
bool whether the two arrays have the same value (or lack of one) for a given key.

Definition at line 712 of file lib.php.

Here is the caller graph for this function:

static arrays_same_at_key_integer ( array array1,
array array2,
key 
) [static]

Tests to see whether two arrays have the same value at a particular key. Missing values are replaced by 0, and then the values are cast to integers and compared with ===.

Parameters:
array$array1the first array.
array$array2the second array.
string$keyan array key.
Returns:
bool whether the two arrays have the same value (or lack of one) for a given key.

Definition at line 757 of file lib.php.

Here is the caller graph for this function:

static arrays_same_at_key_missing_is_blank ( array array1,
array array2,
key 
) [static]

Tests to see whether two arrays have the same value at a particular key. Missing values are replaced by '', and then the values are cast to strings and compared with ===.

Parameters:
array$array1the first array.
array$array2the second array.
string$keyan array key.
Returns:
bool whether the two arrays have the same value (or lack of one) for a given key.

Definition at line 732 of file lib.php.

Here is the caller graph for this function:

static int_to_roman ( number) [static]

Convert an integer to roman numerals.

Parameters:
int$numberan integer between 1 and 3999 inclusive. Anything else will throw an exception.
Returns:
string the number converted to lower case roman numerals.

Definition at line 783 of file lib.php.

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations