Available PHP Functions
The following PHP functions are available in the templates:
| function | Description |
|---|---|
| array_change_key_case() | Changes all keys in an array to lowercase or uppercase |
| array_combine() | Creates an array by using the elements from one "keys" array and one "values" array |
| array_diff() | Compares array against one or more other arrays and returns the values in array that are not present in any of the other arrays. |
| array_diff_key() | Compares the keys from array against the keys from arrays and returns the difference. This function is like array_diff() except the comparison is done on the keys instead of the values. |
| array_filter() | Filters the values of an array using a callback function |
| array_flip() | Flips/Exchanges all keys with their associated values in an array |
| array_intersect() | Compare arrays, return an array containing all the values of array that are present in all the arguments. Note that keys are preserved. |
| array_intersect_key() | Compare arrays, return the matches (compare keys only) |
| array_key_exists() | Checks if the specified key exists in the array |
| array_key_first() | Returns the first key of array if the array is not empty; null otherwise. |
| array_keys() | Returns all the keys of an array |
| array_merge() | Merges one or more arrays into one array |
| array_pop() | Deletes the last element of an array |
| array_rand() | Returns one or more random keys from an array |
| array_replace() | Replaces the values of the first array with the values from following arrays |
| array_reverse() | Returns an array in the reverse order |
| array_shift() | Removes the first element from an array, and returns the value of the removed element |
| array_unique() | Removes duplicate values from an array |
| array_values() | Return all the values of an array |
| arsort() | Sorts an associative array in descending order, according to the value |
| asort() | Sorts an associative array in ascending order, according to the value |
| base64_decode() | Decodes a base64 encoded string. |
| base64_encode() | Encodes the given string with base64 |
| bin2hex() | Converts a string of ASCII characters to hexadecimal values |
| ceil() | Rounds a number up to the nearest integer |
| count() | Returns the number of elements in an array |
| date() | Formats a local date and time |
| date_create() | Returns a new DateTime object |
| empty() | Checks whether a variable is empty |
| end() | Sets the internal pointer of an array to its last element |
| error() | Display and log an error message |
| explode() | Breaks a string into an array |
| floor() | Rounds a number down to the nearest integer |
| gettype() | Returns the type of a variable |
| hash() | Generate a hash value (message digest) |
| hash_hmac() | Generate a keyed hash value using the HMAC method |
| htmlspecialchars() | Converts some predefined characters to HTML entities |
| htmlspecialchars_decode() | Converts some predefined HTML entities to characters |
| http_build_query() | Generates a URL-encoded query string from the associative (or indexed) array provided |
| implode() | Returns a string from the elements of an array |
| in_array() | Checks if a specified value exists in an array |
| is_array() | Checks whether a variable is an array |
| is_bool() | Checks whether a variable is a boolean |
| is_float() | Checks whether a variable is of type float |
| is_int() | Checks whether a variable is of type integer |
| is_null() | Checks whether a variable is NULL |
| is_numeric() | Checks whether a variable is a number or a numeric string |
| is_object() | Checks whether a variable is an object |
| is_string() | Checks whether a variable is of type string |
| isset() | Checks whether a variable is set (declared and not NULL) |
| join() | Alias of implode() |
| json_decode() | Decodes a JSON string |
| json_encode() | Encode a value to JSON format |
| krsort() | Sorts an associative array in descending order, according to the key |
| ksort() | Sorts an associative array in ascending order, according to the key |
| lcfirst() | Converts the first character of a string to lowercase |
| ltrim() | Removes whitespace or other characters from the left side of a string |
| max() | Returns the highest value in an array, or the highest value of several specified values |
| microtime() | Returns the current Unix timestamp with microseconds |
| min() | Returns the lowest value in an array, or the lowest value of several specified values |
| number_format() | Formats a number with grouped thousands |
| openssl_random_pseudo_bytes() | Generates a string of pseudo-random bytes, with the number of bytes determined by the length parameter. |
| preg_filter() | Perform a regular expression search and replace |
| preg_grep() | Return array entries that match the pattern |
| preg_last_error() | Returns the error code of the last PCRE regex execution |
| preg_match_all() | Perform a global regular expression match |
| preg_match() | Perform a regular expression match |
| preg_quote() | Quote regular expression characters |
| preg_replace() | Perform a regular expression search and replace |
| preg_split() | Split string by a regular expression |
| round() | Rounds a floating-point number |
| rtrim() | Removes whitespace or other characters from the right side of a string |
| sort() | Sorts an indexed array in ascending order |
| split() | Alias for explode() |
| str_pad() | Pads a string to a new length |
| str_replace() | Replaces some characters in a string (case-sensitive) |
| strip_tags() | Strips HTML and PHP tags from a string |
| stripslashes() | Unquotes a string quoted with addslashes() |
| strlen() | Returns the length of a string |
| strpos() | Returns the position of the first occurrence of a string inside another string (case-sensitive) |
| strrpos() | Finds the position of the last occurrence of a string inside another string (case-sensitive) |
| strstr() | Finds the first occurrence of a string inside another string (case-sensitive) |
| strtolower() | Converts a string to lowercase letters |
| strtoupper() | Converts a string to uppercase letters |
| substr() | Returns a part of a string |
| time() | Returns the current time as a Unix timestamp |
| timezone_offset_get() | Returns the timezone offset from GMT |
| timezone_open() | Creates new DateTimeZone object |
| trim() | Removes whitespace or other characters from both sides of a string |
| ucfirst() | Converts the first character of a string to uppercase |
| ucwords() | Converts the first character of each word in a string to uppercase |
| urlencode() | URL-encodes string |