1. Home
  2. Docs
  3. Packages
  4. Core package
  5. Functions


We have a collection of built-in functions you can use in the Editor in combination with expression language.
Some are built-in functions imported from the PHP language, while others were created specifically for use in Editor. You can learn how to use functions in our Expression language guide.

PHP Functions

String Manipulation:

  • strtolower: Converts a string to lowercase.
  • strtoupper: Converts a string to uppercase.
  • ucfirst: Converts the first character of a string to uppercase.
  • ucwords: Uppercase the first character of each word in a string.
  • strlen: Returns the length of a string.
  • str_replace: Replaces all occurrences of the search string with the replacement string in a string.
  • substr: Returns a part of a string.
  • stripos: Returns the position of the first occurrence of a case-insensitive substring in a string.
  • explode: Splits a string by string and returns an array of substrings.
  • implode: Joins array elements with a string.
  • trim: Strips whitespace (or other characters) from the beginning and end of a string.
  • preg_replace: Performs a regular expression search and replace on a string.
  • htmlentities: Converts all applicable characters to HTML entities.
  • htmlspecialchars: Converts special characters to HTML entities.
  • html_entity_decode: Converts HTML entities to their corresponding characters.
  • is_string: Checks if the variable is a string.

Array Manipulation:

  • count: Counts all elements in an array, or properties in an object.
  • array_rand: Picks one or more random keys out of an array.
  • array_values: Returns all the values of an array.
  • array_splice: Removes a portion of the array and replaces it with something else.
  • is_array: Finds whether a variable is an array.
  • in_array: Checks if a value exists in an array.
  • array_search: Searches the array for a given value and returns the corresponding key if successful.
  • array_column: Returns the values from a single column in the input array.
  • array_keys: Returns all the keys of an array.
  • array_merge: Combines one or more arrays into a single array.
  • array_diff: Computes the difference of arrays.
  • array_filter: Filters elements of an array using a callback function.
  • unserialize: Creates a PHP value from a stored representation.
  • serialize: Generates a storable representation of a value.
  • array_slice: Extracts a slice of an array.
  • array_chunk: Splits an array into chunks.
  • is_countable: Checks if the variable is countable.

Numeric Operations:

  • is_numeric: Finds whether a variable is a number or a numeric string.
  • is_int: Finds whether a variable is an integer.
  • intval: Returns the integer value of a variable.
  • strval: Returns the string value of a variable.
  • ceil: Rounds a number up to the nearest integer.
  • floor: Rounds a number down to the nearest integer.
  • round: Rounds a float.
  • number_format: Formats a number with grouped thousands.
  • is_float: Checks if the variable is a float.
  • is_long: Alias of is_int() – Checks if the variable is a long (integer).

Date and Time:

  • date: Formats a local date and time.
  • strtotime: Parses an English textual datetime into a Unix timestamp.
  • time: Returns the current time as a Unix timestamp.

File Operations:

JSON Manipulation:

  • json_last_error_msg: Returns the error message of the last JSON encoding or decoding operation.
  • json_last_error: Returns the last error occurred during a JSON encoding or decoding operation.
  • json_encode: Returns the JSON representation of a value.
  • json_decode: Decodes a JSON string into a PHP value.

URL and Filtering:


  • rand: Generates a random integer.
  • is_object: Finds whether a variable is an object.
  • set_time_limit: Sets the maximum execution time for a script.
  • base64_encode: Encodes data with MIME base64.
  • hash_hmac: Generate a keyed hash value using the HMAC method.
  • uniqid: Generate a unique ID.
  • function_exists: Return true if the given function has been defined.
  • is_null: Checks if the variable is NULL.

Custom Functions

Array Functions:

Function Name Description Arguments Return Type
array_shuffle Shuffles the elements of an array. $array: The array to shuffle. Shuffled array, or the original value if not an array.
array_push Appends an item to an array. $array: The target array.
$item: The item to append.
Modified array, or the original value if not an array.
array_sort_by_field Sorts an array based on a specified field. $array: The target array.
$field: The field to sort by.
Sorted array, or the original value if not an array.
human_concat Joins an array into a human-readable string, optionally using a specified conjunction for the last element. $array: The target array.
$conjunction (Optional): The conjunction to use for the last element.
Human-readable string, or the original value if not an array.

String Functions:

Function Name Description Arguments Return Type
print_r Prints human-readable information about a variable. $val: The variable to display. String representation of the variable.
decode_special_chars Decodes special characters in a string. $string: The string to decode. Decoded string, or the original value if not a string.
ordinal Returns the ordinal representation of a number (e.g., 1st, 2nd, 3rd). $string: Numeric string. Ordinal string, or the original value if not numeric.
html_to_markdown Converts an HTML string to Markdown format. $html: The HTML string to convert.
$options (Optional): Array of options for conversion.
Markdown formatted string.
parse_cvs_file Parses a CSV file and returns its contents as a multidimensional array. $path: The path to the CSV file.
$separator (Optional): The separator character used in the CSV file. Default is comma (,).
Multidimensional array containing the contents of the CSV file.

General Functions:

Function Name Description Arguments Return Type
empty Determines whether a variable is empty. $var: The variable to check. Boolean (true if empty, false otherwise).
call_user_func This function allows you to dynamically call a user-defined function with specified arguments. $callback: The function name as a string.
$parameter (Optional): An indexed array of parameters to be passed to the function.
The return value of the called function.

Date and Time Functions:

Function Name Description Arguments Return Type
relative_date Returns a relative date string. `$date`: The target date.
`$startDayOfWeek` (Optional): Starting day of the week.
Relative date string.
date_tz Returns a formatted date string adjusted for a specified timezone. `$format`: Date format.
`$timestamp` (Optional): Target timestamp.
`$timezone` (Optional): Target timezone.
Formatted date string, or false on failure.
strtotime_tz Converts a datetime string into a Unix timestamp, optionally adjusted for a timezone. `$datetime`: Datetime string.
`$baseTimestamp` (Optional): Base timestamp for relative datetime calculations.
`$timezone` (Optional): Timezone for the datetime string.
Unix timestamp.
parse_date_time Parses a date-time string, potentially adjusting for platform-specific quirks. `$date`: Date string.
`$platform` (Optional): The platform string. Default is ‘amazon’.
Parsed date-time string or false on failure.
parse_duration Parses a duration string, potentially adjusting for platform-specific quirks and returning a default duration if none provided. `$duration`: Duration string.
`$platform` (Optional): The platform string. Default is ‘amazon’.
`$defaultDuration` (Optional): Default duration to return if none provided.
Parsed duration in seconds or the default duration.