Chapter 3. Function Library

This section describes the built-in subroutines in the Qore language making up the system function library. Following is a list of function categories, and below there is an alphabetically-ordered list of all Qore built-in functions.

Table 3.1. System Function Category List


Each builtin function or method has flags that describe its properties. The following table provides the key to the flags as given in the function and method lists.

Table 3.2. Code Flags

Abbr

Description

NOOP

Code with this flag makes no calculations, but rather returns a constant value. This flag is given to function and method variants that return a default value depending on the type of argument(s). When variants with this flag are resolved at parse time, a call-with-type-errors warning is raised (assuming this warning is enabled).

RT_NOOP

Code with this flag makes no calculations, but rather returns a constant value. This flag is given to function and method variants that return a default value depending on the type of argument(s). When variants with this flag are resolved at parse time, a call-with-type-errors warning is raised (assuming this warning is enabled), unless PO_REQUIRE_TYPES or PO_STRICT_ARGS is set. If PO_REQUIRE_TYPES or PO_STRICT_ARGS is set, then these variants are inaccessible; resolving to a variant with this flag set at parse time or run time causes an exception to be thrown. These variants are included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

CONST

Code with this flag is safe to be used when assigning a constant, because it has no side effects and normally does not throw an exception (at least in the context of assigning a constant).

DEPRECATED

Code with this flag is deprecated and will be removed in a future version of Qore; if a variant with this flag is resolved at parse time, a deprecated warning is raised (assuming this warning is enabled).


Table 3.3. System Function Library

Function Name

Ex?

Brief Description

abort() returns nothing

N

aborts the process

abs(softfloat) returns float

abs(int) returns int

abs() returns float (RT_NOOP)

N

Returns the absolute value of the argument passed

acos(any) returns float

N

Returns the arc cosine of the number passed in radians

asin(softfloat) returns float

asin() returns float (RT_NOOP)

N

Returns the arc sine of the number passed in radians.

atan(softfloat) returns float

atan() returns float (RT_NOOP)

N

Returns the arc tangent of the number passed in radians.

backquote(string) returns string

backquote() returns nothing (RT_NOOP)

Y

Executes a process and returns a string of the output (stdout only)

basename(string) returns string

basename() returns nothing (RT_NOOP)

N

Returns a string giving the last element of a file path.

binary(softstring) returns binary (CONST)

binary(binary) returns binary (CONST)

binary(null) returns binary (CONST)

binary() returns binary (CONST)

N

Returns a binary data type of the data passed.

binary_to_string(binary) returns string

binary_to_string(binary, string) returns string

Y

Returns a string created from the binary data passed.

bindex(softstring, softstring, softint = 0) returns int

bindex() returns int (RT_NOOP)

N

Returns the byte position of a substring within a string and takes an optional starting offset

blowfish_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for the blowfish algorithm.

blowfish_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for the blowfish algorithm.

blowfish_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for the blowfish algorithm.

boolean(softbool) returns bool (CONST)

boolean(null) returns bool (CONST)

boolean() returns bool (CONST)

N

Converts the argument to a boolean value.

brindex(softstring, softstring, softint = -1) returns int

brindex() returns int (RT_NOOP)

N

Returns the byte position of a substring within a string as searched from the end of the string and takes an optional starting offset

bunzip2_to_binary(binary) returns binary

bunzip2_to_binary() returns nothing (RT_NOOP)

Y

Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a binary.

bunzip2_to_string(binary, string = defaultEncoding) returns string

bunzip2_to_string() returns nothing (RT_NOOP)

Y

Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a string.

bzip2(data, softint = 9) returns binary

bzip2() returns nothing> (RT_NOOP)

Y

Compresses the given data with the bzip2 algorithm and returns the uncompressed data as a binary.

call_builtin_function(string, ...) returns any

Y

Calls a builtin function identified by the first string argument and returns the return value, passing the remaining arguments after the function name to the function

call_builtin_function_args(string, list) returns any

call_builtin_function_args(string, any) returns any

Y

Calls a builtin function identified by the first string argument and returns the return value, using the argument after the function name as a list of arguments to pass to the function.

call_function(string, ...) returns any

call_function(code, ...) returns any

Y

Calls a function, closure, or call reference and returns the return value, passing the remaining arguments after the function name to the function (or call reference).

call_function_args(string, list) returns any

call_function_args(string, any) returns any

call_function_args(code, list) returns any

call_function_args(code, any) returns any

Y

Calls a function, closure, or call reference and returns the return value, using the argument after the function name as a list of arguments to pass to the function, closure, or call reference.

callObjectMethod(object, string) returns any

callObjectMethod() returns nothing (RT_NOOP)

Y

calls a method given by a string of the object passed, passing the remaining arguments to the method as arguments

callObjectMethodArgs(object, string, list) returns any

callObjectMethodArgs(object, string, any) returns any

callObjectMethodArgs() returns nothing (RT_NOOP)

Y

calls a method given by a string of the object passed, using the argument after the method name as the list of arguments to pass to the method

cast5_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for the CAST5 algorithm.

cast5_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm.

cast5_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for the CAST5 algorithm.

cbrt(softfloat) returns float

cbrt() returns float (RT_NOOP)

N

Returns the cube root of the number passed.

ceil(softfloat) returns float

ceil() returns float (RT_NOOP)

N

Returns a value rounded up to the next highest integer

chdir(string) returns int

Y

Changes the current working directory.

chmod(string, int) returns int

Y

Changes the mode of a file.

chomp(string) returns string

chomp(reference) returns any

N

Removes the trailing end-of-line indicator from a string and returns the new string (also see the chomp operator); also accepts variable references to do modifications in-place.

chown(string, softint = -1, softint = -1) returns int

N

Changes the user and group owners of a file (if the current user has permission to do so), follows symbolic links.

chr(softint) returns string

chr(any) returns string (NOOP)

chr() returns nothing (RT_NOOP)

N

Returns a string containing a single ASCII character represented by the numeric value passed.

clock_getmicros() returns int (CONST)

N

Returns the system time in microseconds (1/1000000 second intervals) since Jan 1, 1970 00:00:00Z.

clock_getmillis() returns int (CONST)

N

Returns the system time in milliseconds (1/1000 second intervals) since Jan 1, 1970 00:00:00Z.

clock_getnanos() returns int (CONST)

N

Returns the system time in nanoseconds (1/1000000000 second intervals) since Jan 1, 1970 00:00:00.

compress(data, softint = -1) returns binary

compress() returns nothing (RT_NOOP)

Y

Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data.

convert_encoding(string, string) returns string (CONST)

convert_encoding() returns nothing (RT_NOOP)

Y

Performs explicit string character encoding conversions.

cos(softfloat) returns float (CONST)

cos() returns float (RT_NOOP)

N

Returns the cosine of the number in radians passed.

cosh(softfloat) returns float (CONST)

cosh() returns float (RT_NOOP)

N

Returns the hyperbolic cosine of the number passed.

date(string) returns date (CONST)

date(softint) returns date (CONST)

date(null) returns date (CONST)

date() returns date (CONST)

N

Converts the argument passed to a date.

date_ms(softint) returns date (CONST)

date_ms() returns date (RT_NOOP)

N

Converts an integer argument as a millisecond offset from January 1, 1970Z to a date.

date_us(softint) returns date (CONST)

date_us() returns date (RT_NOOP)

N

Converts an integer argument as a microsecond offset from January 1, 1970Z to a date.

days(softint) returns date (CONST)

days() returns date (RT_NOOP)

N

Returns a relative date in days for date arithmetic.

decode_url(string) returns string (CONST)

decode_url() returns nothing (RT_NOOP)

N

Decodes percent numeric codes in a URL string and returns the decoded string.

delete_all_thread_data()

N

Deletes all keys in the thread-local data hash.

delete_thread_data(list) returns nothing

delete_thread_data(...) returns nothing

N

Deletes the data associated to one or more keys in the thread-local data hash (destroys any objects as well).

des_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for the DES algorithm.

des_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for the DES algorithm.

des_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data using the Cipher Block Chaining function for the DES algorithm.

des_ede_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm.

des_ede_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm.

des_ede_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for the two-key triple DES algorithm.

des_ede3_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm.

des_ede3_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm.

des_ede3_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for the three-key triple DES algorithm.

desx_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm.

desx_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm.

desx_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Encrypts data to a string using the Cipher Block Chaining function for RSA's DESX algorithm.

DSS(data) returns string

Y

Returns the DSS message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

DSS_bin(data) returns binary

Y

Returns the DSS message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

DSS1(data) returns string

Y

Returns the DSS1 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

DSS1_bin(data) returns binary

Y

Returns the DSS1 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

errno() returns int

N

Returns the value of the system "errno" variable, holding the last error code generated by a system call

exec(string) returns nothing

exec() returns nothing (RT_NOOP)

N

Replaces the current process image with another.

existsFunction(string) returns bool (CONST)

existsFunction(code) returns bool (NOOP)

existsFunction() returns nothing (RT_NOOP)

N

Returns True if the function exists in the current program's function name space.

exit(any = 0) returns nothing

N

Exits the program

exp(softfloat) returns float (CONST)

exp() returns float (RT_NOOP)

N

Returns the value of e raised to the power of the argument passed

exp2(softfloat) returns float (CONST)

exp2() returns float (RT_NOOP)

N

Returns the value of 2 raised to the power of the argument passed

expm1(softfloat) returns float (CONST)

expm1() returns float (RT_NOOP)

N

Returns an equivalent of exp(x) - 1

f_printf(string, ...) returns string

f_printf() returns string (RT_NOOP)

Y

"field" printf, field width specifiers are respected. Returns string printed.

f_sprintf(string, ...) returns string (CONST)

f_sprintf() returns string (RT_NOOP)

Y

"field" sprintf(), field width specifiers are respected

float(softfloat) returns float (CONST)

float(null) returns float (CONST)

float() returns float (CONST)

N

Returns the argument converted to a floating-point number

floor(softfloat) returns float (CONST)

floor() returns float (RT_NOOP)

N

Returns a value rounded down to the nearest integer

flush() returns nothing

N

Flushes output to the console output with print(), printf(), etc

force_encoding(string, string) returns string (CONST)

force_encoding() returns nothing (RT_NOOP)

N

Returns a string tagged with the given character encoding; does not actually change the string data; use only in the case that a string is tagged with the wrong encoding.

fork() returns int

N

Creates a duplicate of the current process

format_date(string, date) returns string (CONST)

format_date() returns nothing (RT_NOOP)

N

Allows dates to be formatted

format_number(string, any) returns string (CONST)

format_number() returns nothing (RT_NOOP)

N

Allows numbers to be formatted with more options than sprintf()

functionType(string) returns any (CONST)

functionType() returns nothing (RT_NOOP)

N

Returns "builtin", "user", or NOTHING according to the function name passed

get_all_thread_data() returns hash (CONST)

N

Returns the entire thread data hash.

get_byte(string, int = 0) returns any (CONST)

N

Returns the byte value at the given byte offset or NOTHING if the offset is not legal for the given data.

get_days(date) returns int (CONST)

get_days() returns nothing (RT_NOOP)

N

Returns an integer value representing the days value of the date passed (can be either a relative or absolute date).

get_default_encoding() returns string (CONST)

N

Returns the name of the default character encoding for the Qore library.

get_duration_microseconds(date) returns int (CONST)

N

Returns an integer giving the duration in microseconds as described by the argument; if the argument is a relative date, then it is converted to microseconds, if it is absolute, then a number of microseconds between the current time and the time given is returned.

get_duration_milliseconds(date) returns int (CONST)

N

Returns an integer giving the duration in milliseconds as described by the argument; if the argument is a relative date, then it is converted to milliseconds, if it is absolute, then a number of milliseconds between the current time and the time given is returned.

get_duration_seconds(date) returns int (CONST)

N

Returns an integer giving the duration in seconds as described by the argument; if the argument is a relative date, then it is converted to seconds, if it is absolute, then a number of seconds between the current time and the time given is returned.

get_encoding(string) returns string (CONST)

get_encoding() returns nothing (RT_NOOP)

N

Returns a string describing the character encoding of the string passed.

get_epoch_seconds(date) returns int (CONST)

get_epoch_seconds() returns nothing (RT_NOOP)

N

Returns the number of seconds after Jan 1, 1970, 00:00:00Z for the date/time value passed.

get_hours(date) returns int (CONST)

get_hours() returns nothing (RT_NOOP)

N

Returns an integer value representing the hours value of the date passed (can be either a relative or absolute date).

get_microseconds(date) returns int (CONST)

N

Returns an integer value representing the microseconds value of the date passed (can be either a relative or absolute date).

get_midnight(date) returns date (CONST)

get_midnight() returns nothing (RT_NOOP)

N

Returns a date/time value representing midnight on the date passed (strips the time from the date passed and returns the new value)

get_milliseconds(date) returns int (CONST)

get_milliseconds() returns nothing (RT_NOOP)

N

Returns an integer value representing the milliseconds value of the date passed (can be either a relative or absolute date).

get_minutes(date) returns int (CONST)

get_minutes() returns nothing (RT_NOOP)

N

Returns an integer value representing the minutes value of the date passed (can be either a relative or absolute date).

get_months(date) returns int (CONST)

get_months() returns nothing (RT_NOOP)

N

Returns an integer value representing the months value of the date passed (can be either a relative or absolute date).

get_qore_library_info() returns hash (CONST)

N

Returns a hash of build and version information for the qore library.

get_qore_option_list() returns list (CONST)

N

Returns a list of hashes giving information about qore library options.

get_seconds(date) returns int (CONST)

get_seconds() returns nothing (RT_NOOP)

N

Returns an integer value representing the seconds value of the date passed (can be either a relative or absolute date).

get_script_path() returns any (CONST)

N

Returns a string giving the path (directory and filename) from which the current script was executed (if known).

get_script_dir() returns any (CONST)

N

Returns a string giving the directory from which the current script was executed (if known).

get_script_name() returns any (CONST)

N

Returns a string giving the filename of the current script (if known).

get_thread_data(string) returns any (CONST)

get_thread_data() returns nothing (RT_NOOP)

N

Returns the value of the thread-local data attached to the key passed

get_word_16(data, softint = 0) returns any (CONST)

N

Returns the 16-bit value at the given 2-byte offset or NOTHING if the offset is not legal for the given data; assumes MSB byte order.

get_word_16_lsb(data, softint = 0) returns any (CONST)

N

Returns the 16-bit value at the given 2-byte offset or NOTHING if the offset is not legal for the given data; assumes LSB byte order.

get_word_32_lsb(data, softint = 0) returns any (CONST)

N

Returns the 32-bit value at the given 4-byte offset or NOTHING if the offset is not legal for the given data; assumes LSB byte order..

get_word_64_lsb(data, softint = 0) returns any (CONST)

N

Returns the 64-bit value at the given 8-byte offset or NOTHING if the offset is not legal for the given data; assumes LSB byte order..

get_years(date) returns int (CONST)

get_years() returns nothing (RT_NOOP)

N

Returns an integer value representing the years value of the date passed (can be either a relative or absolute date).

getAllThreadCallStacks() returns hash

N

Returns a hash of call stacks keyed by each TID (thread ID).

getByte(data, softint = 0) returns any (CONST)

getByte() returns nothing (RT_NOOP)

N

Returns the byte value withing the string or binary object passed, or if the offset is out of range, returns NOTHING.

getClassName(object) returns string (CONST)

getClassName() returns nothing (RT_NOOP)

N

Returns the class name of the object passed.

getcwd() returns any

N

Returns the name of the current working directory or NOTHING if an error occurs.

getcwd2() returns string

Y

Returns the name of the current working directory and throws an exception if an error occurs.

getDateFromISOWeek(softint, softint, softint = 1) returns date

Y

Retuns an absolute date value in the local time zone for the ISO-8601 calendar week information passed (year, week number, optional: day); throws an exception if the arguments are invalid.

getDayOfWeek(date) returns int (CONST)

getDayOfWeek() returns nothing (RT_NOOP)

N

Returns an integer representing the day of the week for the absolute date passed (0=Sunday, 6=Saturday)

getDayNumber(date) returns int (CONST)

getDayNumber() returns nothing (RT_NOOP)

N

Returns an integer representing the ordinal day number in the year for the absolute date passed

getDBIDriverCapabilities(string) returns any

getDBIDriverCapabilities() returns nothing (RT_NOOP)

N

Returns an integer representing the capabilities of a DBI driver or NOTHING if the driver cannot be loaded.

getDBIDriverCapabilityList(string) returns any

getDBIDriverCapabilityList() returns nothing (RT_NOOP)

N

Returns a list of codes representing the capabilities of a DBI driver of NOTHING if the driver cannot be loaded.

getDBIDriverList() returns any

N

Returns a list of strings of DBI drivers currently loaded or NOTHING if no drivers have been loaded.

getegid() returns int (CONST)

N

Returns the effective group ID of the current process.

geteuid() returns int (CONST)

N

Returns the effective user ID of the current process.

getFeatureList() returns list (CONST)

N

Returns a list of strings of the builtin and module-supplied features of Qore.

getenv(string) returns any (CONST)

getenv() returns nothing (RT_NOOP)

N

Retrieves the value of an environment variable or NOTHING if the variable is not set

getgid returns int (CONST)

N

Returns the real group ID of the current process.

getgrnam(string) returns any (CONST)

N

Returns a hash representing the group information of the group name passed or NOTHING if the group name is not found.

getgrnam2(string) returns hash

N

Returns a hash representing the group information of the group name passed; throws an exception if the group name is not found.

getgrgid(softint) returns any (CONST)

N

Returns a hash representing the group information of the group ID passed or NOTHING if the group ID is not found.

getgrgid2(softint) returns hash

N

Returns a hash representing the group information of the group ID passed; throws an exception if the group ID is not found.

gethostbyaddr(string, softint = AF_INET) returns any (CONST)

gethostbyaddr() returns nothing (RT_NOOP)

N

Returns the official hostname corresponding to the network addressed passed or NOTHING if the address cannot be resolved.

gethostbyaddr_long(string, softint = AF_INET) returns any (CONST)

gethostbyaddr_long() returns nothing (RT_NOOP)

N

Returns all host information corresponding to the network address as a hash or NOTHING if the address cannot be resolved.

gethostbyname(string) returns any (CONST)

gethostbyname() returns nothing (RT_NOOP)

N

Returns the first network address corresponding to the hostname as a string or NOTHING if the name cannot be resolved.

gethostbyname_long(string) returns any (CONST)

N

Returns all host information corresponding to the hostname as a hash or NOTHING if the name cannot be resolved.

gethostname() returns string

Y

Returns the hostname of the system; throws an exception if an error occurs.

getISODayOfWeek(date) returns int (CONST)

getISODayOfWeek() returns nothing (RT_NOOP)

N

Returns an integer representing the ISO-8601 day of the week for the absolute date passed (1=Monday, 7=Sunday)

getISOWeekHash(date) returns hash (CONST)

getISOWeekHash() returns nothing (RT_NOOP)

N

Returns a hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: year, week, day)

getISOWeekString(date) returns string (CONST)

getISOWeekString() returns nothing (RT_NOOP)

N

Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7")

getMethodList(object) returns list (CONST)

getMethodList() returns nothing (RT_NOOP)

N

Returns a list of strings of the names of the public and private methods of the class of the object passed as a parameter (does not return base class method names).

getModuleList() returns list (CONST)

N

Returns a list of hashes describing the currently-loaded Qore modules.

getpid() returns int (CONST)

N

Returns the PID (process ID) of the current process.

getppid() returns int (CONST)

N

Returns the parent PID of the current process.

getpwnam(string) returns any (CONST)

N

Returns a hash representing the user information of the username passed or NOTHING if the username is not found.

getpwnam2(string) returns hash

N

Returns a hash representing the user information of the username passed; throws an exception if the username is not found.

getpwuid(softint) returns any (CONST)

N

Returns a hash representing the user information of the user ID passed or NOTHING if the user ID is not found.

getpwuid2(softint) returns hash

N

Returns a hash representing the user information of the user ID passed; throws an exception if the user ID is not found.

gettid() returns int (CONST)

N

Returns the Qore thread ID (TID) of the current thread.

getuid() returns int (CONST)

N

Returns the real user ID of the current process.

getWord32(string, int = 0) returns any (CONST)

getWord32(binary, int = 0) returns any (CONST)

getWord32() returns nothing (RT_NOOP)

N

Returns the 32-bit value at the given 4-byte offset or NOTHING if the offset is not legal for the given data.

glob(string) returns any

glob() returns nothing (RT_NOOP)

N

Returns a list of files matching the string argument or NOTHING if the call to glob() fails.

gmtime(date) returns date (CONST)

gmtime(softint, softint = 0) returns date (CONST)

gmtime() returns date (CONST)

N

Returns a date/time value in UTC (GMT).

gunzip_to_binary(binary) returns binary

gunzip_to_binary() returns nothing (RT_NOOP)

Y

Uncompresses data compressed with the "gzip" algorithm (RFC 1952) using zlib functions and returns a binary object.

gunzip_to_string(binary) returns string

gunzip_to_string(binary, string) returns string

gunzip_to_string() returns nothing (RT_NOOP)

Y

Uncompresses data compressed with the "gzip" algorithm (RFC 1952) using zlib functions and returns a string.

gzip(string, softint = -1) returns binary

gzip(binary, softint = -1) returns binary

gzip() returns nothing (RT_NOOP)

Y

Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data.

hash(list $list) returns hash

hash(list $keys, list $values) returns hash

hash(hash $hash) returns hash (CONST)

hash(object $obj) returns hash

hash() returns hash (CONST)

N

Converts an object or a list to a hash; otherwise returns an empty hash.

hash_values(hash) returns list (CONST)

hash_values() returns nothing (RT_NOOP)

N

Returns a list of all the values in the hash argument passed.

hextoint(string) returns bigint

Y

Returns an integer for a hexadecimal string value; throws an exception if non-hex digits are found.

hlstat(string) returns any

hlstat() returns nothing (RT_NOOP)

N

Returns a hash of information about the file corresponding to the pathname argument; does not follow symbolic links (returns information about symbolic links). Returns NOTHING if the stat() call fails.

hours(softint) returns date (CONST)

hours() returns date (RT_NOOP)

N

Returns a relative date in hours to be used in date arithmetic.

hstat(string) returns any

hstat() returns nothing (RT_NOOP)

N

Returns a hash of information about the file corresponding to the pathname argument; follows symbolic links. Returns NOTHING if the stat() call fails.

html_decode(string) returns string (CONST)

html_decode() returns nothing (RT_NOOP)

N

Returns a string with any HTML escape codes translated to the original characters

html_encode(string) returns string (CONST)

html_encode() returns nothing (RT_NOOP)

N

Returns a string with any characters that can be escaped translated to HTML escape codes.

hypot(any, softfloat) returns float (CONST)

hypot(softfloat, any) returns float (CONST)

hypot() returns float (RT_NOOP)

N

Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.

index(softstring, softstring, softint = 0) returns int (CONST)

index() returns int (RT_NOOP)

N

Returns the character position of a substring within a string and takes an optional starting offset

inlist(any, list) returns bool

inlist(any, any) returns bool

inlist() returns bool (RT_NOOP)

N

Returns True if the first argument is a member of the second argument list using comparisons with type conversions.

inlist_hard(any, list) returns bool

inlist_hard(any, any) returns bool

N

Returns True if the first argument is a member of the second argument list using comparisons without type conversions.

int(softint) returns int (CONST)

int(null) returns int (CONST)

int() returns int (CONST)

N

Returns the argument converted to an integer

is_bdev(string) returns bool (CONST)

N

Returns True if the string passed identifies a block device file on the filesystem.

is_cdev(string) returns bool (CONST)

N

Returns True if the string passed identifies a character device file on the filesystem.

is_date_absolute(date) returns bool (CONST)

is_date_absolute(any) returns bool (RT_NOOP)

N

Returns True if an absolute date is passed as an argument, False if not.

is_date_relative(date) returns bool (CONST)

is_date_relative(any) returns bool (RT_NOOP)

N

Returns True if a relative date is passed as an argument, False if not.

is_dev(string) returns bool (CONST)

N

Returns True if the string passed identifies a device file (either block or character) on the filesystem.

is_dir(string) returns bool (CONST)

N

Returns True if the string passed identifies a directory on the filesystem.

is_executable(string) returns bool (CONST)

N

Returns True if the string passed identifies an executable file.

is_file(string) returns bool (CONST)

N

Returns True if the string passed identifies a regular file on the filesystem.

is_link(string) returns bool (CONST)

N

Returns True if the string passed identifies a symbolic link on the filesystem.

is_pipe(string) returns bool (CONST)

N

Returns True if the string passed identifies a pipe (FIFO) on the filesystem.

is_readable(string) returns bool (CONST)

N

Returns True if the string passed identifies a file readable by the current user.

is_socket(string) returns bool (CONST)

N

Returns True if the string passed identifies a socket on the filesystem.

is_writeable(string) returns bool (CONST)

N

Returns True if the string passed identifies a file writable by the current user.

join(string, list) returns string (CONST)

join(string, ...) returns string (CONST)

join() returns nothing (RT_NOOP)

N

Creates a string from a list and separator character

kill(softint, softint = SIGHUP) returns int

kill() returns nothing (RT_NOOP)

N

Sends a signal to a process (default: SIGHUP)

lchown(string, softint = -1, softint = -1) returns int

N

Changes the user and group owners of a file (if the current user has permission to do so), does not follow symbolic links.

length(softstring) returns int (CONST)

length(binary) returns int (CONST)

length(any) returns int (NOOP)

length() returns nothing (RT_NOOP)

N

Returns the length in characters for the string passed.

list(...) returns list (CONST)

N

Returns a list with the argument passed as the first element (or an empty list if no argument is passed)

load_module(string) returns nothing

load_module() returns nothing (RT_NOOP)

Y

Loads a Qore module at run-time if the feature name is not already present in the current Program object.

localtime(date) returns date (CONST)

localtime(softint, softint = 0) returns date (CONST)

localtime() returns date (CONST)

N

Returns a date value in localtime; if an argument is passed, then the date is created based on the value of the argument passed, for an integer, it is the number of seconds after Jan 1, 1970, 00:00:00Z (UTC).

log10(softfloat) returns float (CONST)

log10() returns float (RT_NOOP)

N

Returns the base 10 logarithm of the value passed

log1p(softfloat) returns float (CONST)

log1p() returns float (RT_NOOP)

N

Returns the natural logarithm of the value passed plus 1

logb(softfloat) returns float (CONST)

logb() returns float (RT_NOOP)

N

Returns the exponent of a number.

lstat(string) returns any

lstat() returns nothing (RT_NOOP)

N

Returns a list of filesystem values for the file or symbolic link passed or NOTHING if the call to stat() fails.

makeBase64String(data) returns string (CONST)

makeBase64String() returns nothing (RT_NOOP)

N

Returns a base64-encoded representation of a binary object or a string.

makeFormattedJSONRPC11ErrorString(softint, string, any, any) returns string

Y

Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability.

makeFormattedJSONRPCErrorString(any, any, any) returns string

Y

Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability.

makeFormattedJSONRPCRequestString(string, any, any, any) returns string

Y

Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability.

makeFormattedJSONRPCResponseString(any, any, any) returns string

Y

Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability.

makeFormattedJSONString(any, string) returns string

makeFormattedJSONString(any) returns string

Y

Serializes qore data into a JSON string, formatted with line breaks for easier readability.

makeFormattedXMLFragment(hash, string) returns string

makeFormattedXMLFragment(hash) returns string

makeFormattedXMLFragment() returns nothing (RT_NOOP)

Y

Serializes a hash into an XML string with formatting and without an XML header.

makeFormattedXMLRPCCallString(string, ...) returns string

Y

Serializes the arguments into an XML string for an XML-RPC call with formatting.

makeFormattedXMLRPCCallStringWithEncoding(string, string, ...) returns string

Y

Serializes the arguments into an XML string for an XML-RPC call with formatting, taking an initial string argument to give the encoding for the created XML.

makeFormattedXMLRPCCallStringArgs(string, any) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call with formatting, taking a single list argument for the argument list.

makeFormattedXMLRPCCallStringArgsWithEncoding(string, string, any) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call with formatting, taking an initial string argument to give the encoding for the created XML, followed by the method name and a single list argument for the argument list.

makeFormattedXMLRPCFaultResponseString(any, string) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting.

makeFormattedXMLRPCFaultResponseStringWithEncoding(string, any, string) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting, taking an initial string argument to give the encoding for the created XML.

makeFormattedXMLRPCResponseString(...) returns any

Y

Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting; if no arguments are passed, then NOTHING is returned.

makeFormattedXMLRPCResponseStringWithEncoding(string, ...) returns any

Y

Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting, taking an initial string argument to give the encoding for the created XML. If no arguments after the encoding string are passed, then NOTHING is returned.

makeFormattedXMLRPCValueString(any, string) returns string

makeFormattedXMLRPCValueString(any) returns string

Y

Serializes the arguments into an XML string in XML-RPC Value format with whitespace formatting.

makeFormattedXMLString(hash) returns string

makeFormattedXMLString(hash, string) returns string

makeFormattedXMLString(string, hash) returns string

makeFormattedXMLString(string, hash, string) returns string

Y

Serializes a hash into an XML string with formatting and an XML header.

makeHexString(data) returns string (CONST)

makeHexString() returns nothing (RT_NOOP)

N

Returns a hex-encoded representation of a binary object or a string.

makeJSONRPC11ErrorString(softint, string, any, any) returns string

Y

Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks.

makeJSONRPCErrorString(any, any, any) returns string

Y

Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks.

makeJSONRPCRequestString(string, any, any, any) returns string

Y

Creates a JSON-RPC request string from the parameters passed, without any line breaks.

makeJSONRPCResponseString(any, any, any) returns string

Y

Creates a JSON-RPC response string from the parameters passed, without any line breaks.

makeJSONString(any, string) returns string

makeJSONString(any) returns string

Y

Serializes qore data into a JSON string, without any line breaks.

makeXMLFragment(hash, string) returns string

makeXMLFragment(hash) returns string

makeXMLFragment() returns nothing (RT_NOOP)

Y

Serializes a hash into an XML string without an XML header or formatting.

makeXMLRPCCallString(string, ...) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call without formatting.

makeXMLRPCCallStringWithEncoding(string, string, ...) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call without formatting, taking an initial string argument to give the target character encoding for the XML string.

makeXMLRPCCallStringArgs(string, any) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call without formatting, taking a single list argument for the argument list.

makeXMLRPCCallStringArgsWithEncoding(string, string, any) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC call without formatting, taking an initial string argument to give the target character encoding for the XML string followed by a list argument for the argument list.

makeXMLRPCFaultResponseString(any, string) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC fault response without formatting.

makeXMLRPCFaultResponseStringWithEncoding(string, any, string) returns string

Y

Serializes the arguments into an XML string formatted for an XML-RPC fault response without formatting, taking an initial string argument to give the target character encoding for the XML string.

makeXMLRPCResponseString(...) returns any

Y

Serializes the arguments into an XML string formatted for an XML-RPC response without formatting; if no arguments are passed then NOTHING is returned.

makeXMLRPCResponseStringWithEncoding(string, ...) returns any

Y

Serializes the arguments into an XML string formatted for an XML-RPC response without formatting, taking an initial string argument to give the target character encoding for the XML string. If no arguments after the encoding string are passed, then NOTHING is returned.

makeXMLRPCValueString(any, string) returns string

makeXMLRPCValueString(any) returns string

Y

Serializes the arguments into an XML string in XML-RPC Value format without formatting.

makeXMLString(hash) returns string

makeXMLString(hash, string) returns string

makeXMLString(string, hash) returns string

makeXMLString(string, hash, string) returns string

Y

Serializes a hash into a complete XML string with an XML header and without formatting.

max(...) returns any (CONST)

max(list) returns any (CONST)

max(list, string) returns any

max(list, code) returns any

N

Returns the maximum value in a list (see also min()); one variant takes an optional callback reference to process lists of complex data types.

MD2(data) returns string

Y

Returns the MD2 message digest of the supplied argument as a hex string (for string arguments, the trailing null character is not included in the digest)

MD2_bin(data) returns binary

Y

Returns the MD2 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

MD4(data) returns string

Y

Returns the MD4 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

MD4_bin(data) returns binary

Y

Returns the MD4 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

MD5(data) returns string

Y

Returns the MD5 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

MD5_bin(data) returns binary

Y

Returns the MD5 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

MDC2(data) returns string

Y

Returns the MDC2 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

MDC2_bin(data) returns binary

Y

Returns the MDC2 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

microseconds(softint) returns date (CONST)

microseconds() returns date (RT_NOOP)

N

Returns a relative date in microseconds to be used in date arithmetic.

milliseconds(softint) returns date (CONST)

milliseconds() returns date (RT_NOOP)

N

Returns a relative date in milliseconds to be used in date arithmetic.

min(...) returns any (CONST)

min(list) returns any (CONST)

min(list, string) returns any

min(list, code) returns any

N

Returns the minumum value in a list (see also max()); one variant takes an optional closure or call reference to process lists of complex data types.

minutes(softint) returns date (CONST)

minutes() returns date (RT_NOOP)

N

Returns a relative date in minutes to be used in date arithmetic.

mkdir(string, softint = 0777) returns int

Y

Creates a directory with the given mode/permissions.

mkfifo(string, softint = 0600) returns int

N

Creates a named pipe with the given mode/permissions.

mktime(date) returns int (CONST)

mktime() returns nothing (RT_NOOP)

N

Returns the number of seconds after Jan 1, 1970, 00:00:00Z for the date/time value passed.

months(softint) returns date (CONST)

months() returns date (RT_NOOP)

N

Returns a relative date in months to be used in date arithmetic.

nlog(softfloat) returns float (CONST)

nlog() returns float (RT_NOOP)

N

Returns the natural logarithm of the value passed

now() returns date (CONST)

N

Returns current date and time with resolution to the second

now_ms() returns date (CONST)

N

Returns current date and time with resolution to the millisecond

now_us() returns date (CONST)

N

Returns current date and time with resolution to the microsecond

now_utc() returns date (CONST)

N

Returns current UTC date and time with resolution to the microsecond.

num_threads() returns int (CONST)

N

Returns the current number of threads in the process

ord(softstring, softint = 0) returns int (CONST)

ord() returns nothing (RT_NOOP)

N

Gives the numeric value of the character passed

parse(string, string) returns nothing

parse() returns nothing (RT_NOOP)

Y

Adds the text passed to the current program's code

parse_url(string) returns hash

Y

Parses a URL string and returns a hash of the components; throws an exception if the string cannot be parsed as URL.

parseBase64String(string) returns binary

parseBase64String() returns nothing (RT_NOOP)

Y

Parses a base64 encoded string and returns the binary object

parseDatasource(string) returns hash

parseDatasource() returns nothing (RT_NOOP)

N

Returns a hash of the components of a datasource string (ex: "user/pass@db(encoding)%host:port{min=2,max=4}").

parseHexString(string) returns binary

parseHexString() returns nothing (RT_NOOP)

Y

Parses a hex-encoded string and returns the binary object; if invalid hex digits are found an exception is thrown.

parseJSON(string) returns any

parseJSON() returns nothing (RT_NOOP)

Y

Parses a JSON string and returns the corresponding qore data structure.

parseURL(string) returns any

parseURL() returns nothing (RT_NOOP)

N

Parses a URL string and returns a hash of the components, unless the string cannot be parsed as URL in which case NOTHING is returned.

parseXML(string) returns hash

parseXML(string, string) returns hash

parseXML() returns nothing (RT_NOOP)

Y

parses an XML string and returns a Qore hash structure.

parseXMLAsData(string) returns hash

parseXMLAsData(string, string) returns hash

parseXMLAsData() returns nothing (RT_NOOP)

Y

parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list) and returns a Qore hash structure.

parseXMLAsDataWithRelaxNG(string, string) returns hash

parseXMLAsDataWithRelaxNG(string, string, string) returns hash

Y

parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list), validates the generated XML against a RelaxNG schema string, and returns a Qore hash structure.

parseXMLAsDataWithSchema(string, string) returns hash

parseXMLAsDataWithSchema(string, string, string) returns hash

Y

parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list), validates the generated XML against an XSD schema string, and returns a Qore hash structure.

parseXMLAsData(string) returns hash

parseXMLAsData(string, string) returns hash

parseXMLAsData() returns nothing (RT_NOOP)

Y

deserializies an XML-RPC call string, returning a Qore data structure representing the call information.

parseXMLRPCResponse(string) returns hash

parseXMLRPCResponse(string, string) returns hash

parseXMLRPCResponse() returns nothing (RT_NOOP)

Y

deserializies an XML-RPC response string, returning a Qore data structure representing the response information.

parseXMLRPCValue(string) returns hash

parseXMLRPCValue(string, string) returns hash

parseXMLRPCValue() returns nothing (RT_NOOP)

Y

deserializies an XML-RPC value tree, returning Qore data representing the information.

parseXMLWithRelaxNG(string, string) returns hash

parseXMLWithRelaxNG(string, string, string) returns hash

Y

parses an XML string, validates the generated XML against a RelaxNG schema string, and returns a Qore hash structure.

parseXMLWithSchema(string, string) returns hash

parseXMLWithSchema(string, string, string) returns hash

Y

parses an XML string, validates the generated XML against an XSD schema string, and returns a Qore hash structure.

pow(softfloat = 0.0, softfloat = 0.0) returns float

Y

Returns the value of the first argument raised to the power of the second

print(...) returns nothing

N

Prints the string passed without any formatting.

printf(string, ...) returns string

printf() returns string (RT_NOOP)

Y

Prints a formatted string and returns string printed.

rand() returns int

N

Returns a random integer number.

rc2_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm.

rc2_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm.

rc2_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for RSA's RC2(tm) algorithm.

rc4_encrypt(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm.

rc4_decrypt(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm.

rc4_decrypt_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm.

rc5_encrypt_cbc(data, data, data = defaultIV) returns binary

Y

Encrypts data using the Cipher Block Chaining function for RSA's RC5(tm) algorithm.

rc5_decrypt_cbc(binary, data, data = defaultIV) returns binary

Y

Decrypts data using the Cipher Block Chaining function for RSA's RC5(tm) algorithm.

rc5_decrypt_cbc_to_string(binary, data, data = defaultIV) returns string

Y

Decrypts data to a string using the Cipher Block Chaining function for RSA's RC5(tm) algorithm.

readlink(string) returns string

N

Returns the target of a symbolic link; throws an exception if an error occurs.

regex(string, string, int = 0) returns bool

regex() returns nothing (RT_NOOP)

Y

Returns true if the regular expression matches the string passed

regex_extract(string, string, int = 0) returns any

regex_extract() returns nothing (RT_NOOP)

Y

Returns a list of substrings in a string based on matching patterns defined by a regular expression.

regex_subst(string, string, string, int = 0) returns string

regex_subst() returns nothing (RT_NOOP)

Y

Returns a string with patterns substituted according to the arguments passed.

remove_signal_handler(softint) returns nothing

N

Removes an installed signal handler and returns the signal handling state to the default.

remove_thread_data(list) returns nothing

remove_thread_data(...) returns nothing

N

Removes the listed keys from the thread-local data hash.

rename(string, string) returns nothing

Y

Renames (or moves) a file or directory.

replace(string, string, string) returns string

replace() returns nothing (RT_NOOP)

N

Replaces all occurrances of a substring in a string with another string and returns the new string.

reverse(string) returns string (CONST)

reverse(list) returns list (CONST)

reverse() returns nothing (RT_NOOP)

N

Reverses the order of a string or a list and returns the new string or list.

RIPEMD160(data) returns string

Y

Returns the RIPEMD160 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

RIPEMD160_bin(data) returns binary

Y

Returns the RIPEMD160 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

rindex(softstring, softstring, softint = -1) returns int (CONST)

rindex() returns int (RT_NOOP)

N

Returns the starting character position of a string in another string as searched from the end of the string.

rmdir(string) returns int

N

Removes a directory.

round(softfloat) returns float (CONST)

round() returns float (RT_NOOP)

N

Returns a value rounded up to the nearest integer.

save_thread_data(hash) returns nothing

save_thread_data(string, any) returns nothing

save_thread_data() returns nothing (RT_NOOP)

Y

Saves the data passed against the key passed in thread-local storage.

seconds(softint) returns date (CONST)

seconds() returns date (RT_NOOP)

N

Returns a relative date/time value in seconds to be used in date arithmetic.

set_signal_handler(softint, code) returns nothing

N

Installs or replaces a signal handler.

setegid(softint) returns int

N

Changes the process effective group ID according to the argument passed. Returns 0 for success, non-zero for errors (the error code can be retrieved with errno())

seteuid(softint) returns int

N

Changes the process effective user ID according to the argument passed. Returns 0 for success, non-zero for errors (the error code can be retrieved with errno())

setenv(string, softstring) returns int

setenv() returns nothing (RT_NOOP)

N

Sets the value of an environment variable

setgid(softint) returns int

N

Changes the process group ID according to the argument passed. Returns 0 for success, non-zero for errors (the error code can be retrieved with errno())

setsid() returns int

N

Creates a new session lead by the current process.

setuid(softint) returns int

N

Changes the process user ID according to the argument passed. Returns 0 for success, non-zero for errors (the error code can be retrieved with errno())

SHA(data) returns string

Y

Returns the SHA message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA_bin(data) returns binary

Y

Returns the SHA message digest of the supplied argument as a binary object(for strings, the trailing null character is not included in the digest)

SHA1(data) returns string

Y

Returns the SHA1 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA1_bin(data) returns binary

Y

Returns the SHA1 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

SHA224(data) returns string

Y

Returns the SHA224 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA224_bin(data) returns binary

Y

Returns the SHA224 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

SHA256(data) returns string

Y

Returns the SHA256 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA256_bin(data) returns binary

Y

Returns the SHA256 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

SHA384(data) returns string

Y

Returns the SHA384 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA384_bin(data) returns binary

Y

Returns the SHA384 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

SHA512(data) returns string

Y

Returns the SHA512 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest)

SHA512_bin(data) returns binary

Y

Returns the SHA512 message digest of the supplied argument as a binary object (for strings, the trailing null character is not included in the digest)

sleep(softint) returns int

sleep(date) returns int

sleep() returns nothing (RT_NOOP)

N

Causes the current thread to sleep for a certain number of seconds.

sort(list) returns list (CONST)

sort(list, code) returns list

sort(list, string) returns list

sort() returns nothing (RT_NOOP)

Y

Sorts a list in ascending order (unstable); optionally takes a closure or a call reference (function or object method reference) to sort non-trivial data types.

sortDescending(list) returns list (CONST)

sortDescending(list, code) returns list

sortDescending(list, string) returns list

sortDescending() returns nothing (RT_NOOP)

Y

Sorts a list in descending order (unstable); optionally takes a closure or call reference (function or object method reference) to sort non-trivial data types.

sortDescendingStable(list) returns list (CONST)

sortDescendingStable(list, code) returns list

sortDescendingStable(list, string) returns list

sortDescendingStable() returns nothing (RT_NOOP)

Y

Performs a descending stable sort on a list and returns the new list; optionally takes a closure or call reference (function or object method reference) to sort non-trivial data types.

sortStable(list) returns list (CONST)

sortStable(list, code) returns list

sortStable(list, string) returns list

sortStable() returns nothing (RT_NOOP)

Y

Performs an ascending stable sort on a list and returns the new list; optionally takes a closure or call reference (function or object method reference) to sort non-trivial data types.

split(string, string) returns list (CONST)

split(binary, binary) returns list (CONST)

split() returns list (RT_NOOP)

N

Splits a string into a list of components based on a separator string

sprintf(string, ...) returns string (CONST)

sprintf() returns string (RT_NOOP)

Y

Creates a string from the format argument passed and the other arguments.

sin(softfloat) returns float (CONST)

sin() returns float (RT_NOOP)

N

Returns the sine of the number in radians passed.

sinh(softfloat) returns float (CONST)

sinh() returns float (RT_NOOP)

N

Returns the hyperbolic sine of the number passed.

sqrt(softfloat) returns float (CONST)

sqrt() returns float (RT_NOOP)

N

Returns the square root of the number passed.

srand(softint) returns nothing

srand() returns nothing (RT_NOOP)

N

Seeds the random number generator with the integer passed.

stat(string) returns any

stat() returns nothing (RT_NOOP)

N

Returns a list of filesystem information for the filename passed or NOTHING if the stat call fails.

strerror(softint) returns string (CONST)

strerror() returns nothing (RT_NOOP)

N

Returns the description of the error number passed

string(softstring) returns string (CONST)

string(null) returns string (CONST)

string() returns string (CONST)

N

Returns the argument converted to a string

strlen(softstring) returns int (CONST)

strlen(any) returns int (NOOP)

strlen() returns nothing (RT_NOOP)

N

Returns the number of characters in a string.

strtoint(softstring, int = 10) returns int (CONST)

strtoint() returns nothing (RT_NOOP)

N

Returns an integer corresponding to the string passed with the possibility to specify the base (default base 10).

substr(softstring, softint, softint) returns string (CONST)

substr(softstring, softint) returns string (CONST)

substr() returns nothing (RT_NOOP)

N

Returns a substring of a string

system(string) returns int

system() returns nothing (RT_NOOP)

Y

Executes a process and returns the return code

tan(softfloat) returns float (CONST)

tan() returns float (RT_NOOP)

N

Returns the tangent of the number in radians passed.

tanh(softfloat) returns float (CONST)

tanh() returns float (RT_NOOP)

N

Returns the hyperbolic tangent of the number passed.

thread_list() returns list (CONST)

N

Returns a list of all current thread IDs

throwThreadResourceExceptions() returns nothing

Y

Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions.

timegm(date) returns int (CONST)

timegm() returns nothing (RT_NOOP)

N

Returns the number of seconds since January 1, 1970 00:00:00 in the local time zone for a given date.

tolower(string) returns string (CONST)

tolower() returns nothing (RT_NOOP)

N

Converts a string to all lowercase

toupper(string) returns string (CONST)

toupper() returns nothing (RT_NOOP)

N

Converts a string to all uppercase

trim(string, string = "") returns string (CONST)

trim(reference, string = "") returns any

trim() returns nothing (RT_NOOP)

N

Removes the characters from a string (whiltespace by default, can be overridden) and returns the new string (also see the trim operator); also accepts an lvalue reference to do modifications in-place.

type(any) returns string (CONST)

N

Returns the data type of the argument passed (see Type_Constants)

typename(any) returns string (CONST, DEPRECATED)

N

deprecated: use type() instead

umask(softint) returns int

umask() returns nothing (RT_NOOP)

N

Sets the file creation mask for the process

uncompress_to_binary(binary) returns binary

uncompress_to_binary() returns nothing (RT_NOOP)

Y

Uncompresses (inflates) data compressed with the "deflate" algorithm (RFC 1951) using zlib functions and returns a binary object.

uncompress_to_string(binary) returns string

uncompress_to_string(binary, string) returns string

uncompress_to_string() returns nothing (RT_NOOP)

Y

Uncompresses (inflates) data compressed with the "deflate" algorithm (RFC 1951) using zlib functions and returns a string.

unlink(string) returns int

unlink() returns nothing (RT_NOOP)

N

Deletes a file and returns 0 for success.

unsetenv(string) returns int

unsetenv() returns nothing (RT_NOOP)

N

Unsets an environment variable

usleep(date) returns int

usleep(softint) returns int

usleep() returns nothing (RT_NOOP)

N

Causes the current thread to sleep for a certain number of microseconds

vprintf(string, any) returns string

vprintf() returns string (RT_NOOP)

Y

Outputs a formatted string based on a variable number of arguments given in a list after the format string. Returns the string printed.

vsprintf(string, any) returns string

vsprintf() returns string (RT_NOOP)

Y

Formats a string based on a variable number of arguments given in a list after the format string and returns this formatted string.

years(softint) returns date

years() returns date (RT_NOOP)

N

Returns a relative date/time value in years to be used in date arithmetic.


3.1. Math Functions

3.1.1. abs()

Synopsis

Returns the absolute value of the argument passed.

Prototype

abs(softfloat) returns float

abs(int) returns int

abs() returns float (RT_NOOP)

Example
$x = abs($y);

Table 3.4. Arguments and Return Values for abs()

Argument Type

Return Type

Description

int

int

Absolute value of the integer passed.

softfloat

float

Absolute value of the floating-point value passed.


This function does not throw any exceptions.

3.1.2. acos()

Synopsis

Returns the arc cosine of the number passed in radians

Prototype

acos(any) returns float

Example
$x = acos($y);

Table 3.5. Arguments and Return Values for acos()

Argument Type

Return Type

Description

any

float

Returns the arc cosine of the value passed convert to a float in radians.


This function does not throw any exceptions.

3.1.3. asin()

Synopsis

Returns the arc sine of the number passed in radians

Prototype

asin(softfloat) returns float

asin() returns float (RT_NOOP)

Example
$x = asin($y);

Table 3.6. Arguments and Return Values for asin()

Argument Type

Return Type

Description

softfloat

float

Returns the arc sine of the number passed in radians.


This function does not throw any exceptions.

3.1.4. atan()

Synopsis

Returns the arc tangent of the number passed in radians

Prototype

atan(softfloat) returns float

atan() returns float (RT_NOOP)

Example
$x = atan($y);

Table 3.7. Arguments and Return Values for atan()

Argument Type

Return Type

Description

softfloat

float

Returns the arc tangent of the number passed in radians.


This function does not throw any exceptions.

3.1.5. cbrt()

Synopsis

Returns the cube root of the number passed.

Prototype

cbrt(softfloat) returns float

cbrt() returns float (RT_NOOP)

Example
$x = cbrt($y);

Table 3.8. Arguments and Return Values for cbrt()

Argument Type

Return Type

Description

softfloat

float

Returns the cube root of the number passed.


This function does not throw any exceptions.

3.1.6. ceil()

Synopsis

Returns a floating-point number equal to the smallest integral value greater than or equal to the argument passed.

Prototype

ceil(softfloat) returns float

ceil() returns float (RT_NOOP)

Example
$x = ceil(3.2); # will return 4.0 

Table 3.9. Arguments and Return Values for ceil()

Argument Type

Return Type

Description

softfloat

float

Returns a value rounded up to the nearest integral floating-point value.


This function does not throw any exceptions.

3.1.7. cos()

Synopsis

Returns the cosine of the number in radians passed.

Prototype

cos(softfloat) returns float (CONST)

cos() returns float (RT_NOOP)

Example
$x = cos($y);

Table 3.10. Arguments and Return Values for cos()

Argument Type

Return Type

Description

softfloat

float

Returns the cosine of the number in radians passed.


This function does not throw any exceptions.

3.1.8. cosh()

Synopsis

Returns the hyperbolic cosine of the number in radians passed.

Prototype

cosh(softfloat) returns float (CONST)

cosh() returns float (RT_NOOP)

Example
$x = cosh($y);

Table 3.11. Arguments and Return Values for cosh()

Argument Type

Return Type

Description

softfloat

float

Returns the hyperbolic cosine of the number in radians passed.


This function does not throw any exceptions.

3.1.9. exp()

Synopsis

Returns the value of e raised to the power of the argument passed.

Prototype

exp(softfloat) returns float (CONST)

exp() returns float (RT_NOOP)

Example
$x = exp($y);

Table 3.12. Arguments and Return Values for exp()

Argument Type

Return Type

Description

softfloat

float

Returns the value of e raised to the power of the argument passed.


This function does not throw any exceptions.

3.1.10. exp2()

Synopsis

Returns the value of 2 raised to the power of the argument passed.

Prototype

exp2(softfloat) returns float (CONST)

exp2() returns float (RT_NOOP)

Example
$x = exp2($y);

Table 3.13. Arguments and Return Values for exp2()

Argument Type

Return Type

Description

softfloat

float

Returns the value of 2 raised to the power of the argument passed.


This function does not throw any exceptions.

3.1.11. expm1()

Synopsis

Returns an equivalent of exp(x) - 1.

Prototype

expm1(softfloat) returns float (CONST)

expm1() returns float (RT_NOOP)

Example
$x = expm1($y);

Table 3.14. Arguments and Return Values for expm1()

Argument Type

Return Type

Description

softfloat

float

Returns an equivalent of exp(x) - 1.


This function does not throw any exceptions.

3.1.12. floor()

Synopsis

Returns a floating-point value rounded down to the integral value.

Prototype

floor(softfloat) returns float (CONST)

floor() returns float (RT_NOOP)

Example
$x = floor(3.7); # will return 3.0

Table 3.15. Arguments and Return Values for floor()

Argument Type

Return Type

Description

softfloat

float

Returns a float-point value rounded down to the integral value.


This function does not throw any exceptions.

3.1.13. format_number()

Synopsis

Returns a string of a formatted number according to the arguments passed.

Prototype

format_number(string, any) returns string (CONST)

format_number() returns nothing (RT_NOOP)

Description

The format_string has the following format: <thousands_separator>[<decimal_separator><decimals>], where thousands_separator and decimal_separator are single ASCII characters defining the thousands and decimal separator characters respectively, and decimals is a single digit defining how may decimals should appear after the decimal point.

Example
format_number(".,3", -48392093894.2349); # returns "-48.392.093.894,235"

Table 3.16. Arguments and Return Values for format_number()

Argument Types

Return Type

Description

string, any

string

Returns a string corresponding to a number according to the formatting string passed.


This function does not throw any exceptions.

3.1.14. hypot()

Synopsis

Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.

Prototype

hypot(any $x, softfloat $y) returns float (CONST)

hypot(softfloat $x, any $y) returns float (CONST)

hypot() returns float (RT_NOOP)

Example
$z = hypot($x, $y);

Table 3.17. Arguments and Return Values for hypot()

Argument Type

Return Type

Description

softfloat

float

Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.


This function does not throw any exceptions.

3.1.15. log10()

Synopsis

Returns the base 10 logarithm of the value passed.

Prototype

log10(softfloat) returns float (CONST)

log10() returns float (RT_NOOP)

Example
$x = log10($y);

Table 3.18. Arguments and Return Values for log10()

Argument Type

Return Type

Description

softfloat

float

Returns the base 10 logarithm of the value passed.


This function does not throw any exceptions.

3.1.16. log1p()

Synopsis

Returns the natural logarithm of the value passed plus 1.

Prototype

log1p(softfloat) returns float (CONST)

log1p() returns float (RT_NOOP)

Example
$x = log1p($y);

Table 3.19. Arguments and Return Values for log1p()

Argument Type

Return Type

Description

softfloat

float

Returns the natural logarithm of the value passed plus 1.


This function does not throw any exceptions.

3.1.17. logb()

Synopsis

Returns the exponent of a number.

Prototype

logb(softfloat) returns float (CONST)

logb() returns float (RT_NOOP)

Example
$x = logb($y);

Table 3.20. Arguments and Return Values for logb()

Argument Type

Return Type

Description

softfloat

float

Returns the exponent of a number.


This function does not throw any exceptions.

3.1.18. nlog()

Synopsis

Returns the natural logarithm of the value passed.

Prototype

nlog(softfloat) returns float (CONST)

nlog() returns float (RT_NOOP)

Example
$x = nlog();

Table 3.21. Arguments and Return Values for nlog()

Argument Type

Return Type

Description

softfloat

float

Returns the natural logarithm of the value passed.


This function does not throw any exceptions.

3.1.19. pow()

Synopsis

Returns a number raised to the power of another number.

Prototype

pow(softfloat $x = 0.0, softfloat $y = 0.0) returns float

Example
$z = pow($x, $y);

Table 3.22. Arguments and Return Values for pow()

Argument Types

Return Type

Description

softfloat $x

softfloat $y

Returns x raised to the power of y.


Table 3.23. Exceptions Thrown by pow()

err

desc

DIVISION-BY-ZERO

pow(x, y): y must be a non-negative value.

INVALID-POW-ARGUMENTS

pow(x, y): x cannot be negative when y is not an integer value.


3.1.20. round()

Synopsis

Returns a floating-point number equal to the closest integer to the argument passed. Numers halfway between two integers are arounded away from zero. The availability of this function depends on the presence of the C-library's round() function; for maximum portability check the constant HAVE_ROUND before running this function. See Library Option Constants for a list of all option constants.

Prototype

round(softfloat) returns float (CONST)

round() returns float (RT_NOOP)

Example
$x = round(3.2); # returns 3.0 

Table 3.24. Arguments and Return Values for round()

Argument Type

Return Type

Description

softfloat

float

Returns a value rounded to the nearest integral floating-point value, half-way cases are rounded away from zero.


Table 3.25. Exceptions Thrown by round()

err

desc

MISSING-FEATURE-ERROR

This exception is thrown when the function is not available; for maximum portability, check the constant HAVE_ROUND before calling this function.


3.1.21. sin()

Synopsis

Returns the sine of the number in radians passed.

Prototype

sin(softfloat) returns float (CONST)

sin() returns float (RT_NOOP)

Example
$x = sin($y);

Table 3.26. Arguments and Return Values for sin()

Argument Type

Return Type

Description

softfloat

float

Returns the sine of the number in radians passed.


This function does not throw any exceptions.

3.1.22. sinh()

Synopsis

Returns the hyperbolic sine of the number in radians passed.

Prototype

sinh(softfloat) returns float (CONST)

sinh() returns float (RT_NOOP)

Example
$x = sinh($y);

Table 3.27. Arguments and Return Values for sinh()

Argument Type

Return Type

Description

softfloat

float

Returns the hyperbolic sine of the number in radians passed.


This function does not throw any exceptions.

3.1.23. sqrt()

Synopsis

Returns the square root of the number passed.

Prototype

sqrt(softfloat) returns float (CONST)

sqrt() returns float (RT_NOOP)

Example
$x = sqrt($y);

Table 3.28. Arguments and Return Values for sqrt()

Argument Type

Return Type

Description

softfloat

float

Returns the square root of the number passed.


This function does not throw any exceptions.

3.1.24. tan()

Synopsis

Returns the tangent of the number in radians passed.

Prototype

tan(softfloat) returns float (CONST)

tan() returns float (RT_NOOP)

Example
$x = tan($y);

Table 3.29. Arguments and Return Values for tan()

Argument Type

Return Type

Description

softfloat

float

Returns the tangent of the number in radians passed.


This function does not throw any exceptions.

3.1.25. tanh()

Synopsis

Returns the hyperbolic tangent of the number in radians passed.

Prototype

tanh(softfloat) returns float (CONST)

tanh() returns float (RT_NOOP)

Example
$x = tanh($y);

Table 3.30. Arguments and Return Values for tanh()

Argument Type

Return Type

Description

softfloat

float

Returns the hyperbolic tangent of the number in radians passed.


This function does not throw any exceptions.