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.2. System Function Library
Function Name |
Ret Type |
Exception |
Brief Description |
---|---|---|---|
N/A |
N |
aborts the process | |
Float or Integer |
N |
Returns the absolute value of the argument passed | |
Float |
N |
Returns the arc cosine of the number passed in radians | |
Float |
N |
Returns the arc sine of the number passed in radians. | |
Float |
N |
Returns the arc tangent of the number passed in radians. | |
String |
Y |
Executes a process and returns a string of the output (stdout only) | |
String | N | Returns a string giving the last element of a file path. | |
Binary | N | Returns a binary data type of the data passed. | |
String | Y | Returns a string created from the binary data passed. | |
Int |
N |
Returns the byte position of a substring within a string and takes an optional starting offset | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for the blowfish algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for the blowfish algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for the blowfish algorithm. | |
Boolean |
N |
Converts the argument to a boolean value | |
Int |
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 | |
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 | |
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. | |
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). | |
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. | |
any |
Y |
calls a method given by a string of the object passed, passing the remaining arguments to the method as arguments | |
any |
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 | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for the CAST5 algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for the CAST5 algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for the CAST5 algorithm. | |
Float |
N |
Returns the cube root of the number passed. | |
Float | N | Returns a value rounded up to the next highest integer | |
Integer | Y | Changes the current working directory. | |
Integer | Y | Changes the mode of a file. | |
String | 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. | |
String | N | Changes the user and group owners of a file (if the current user has permission to do so), follows symbolic links. | |
String | N | Returns a string containing a single ASCII character represented by the numeric value passed. | |
Integer |
N |
Returns the system time in microseconds (1/1000000 second intervals since Jan 1, 1970 00:00). | |
Integer |
N |
Returns the system time in milliseconds (1/1000 second intervals since Jan 1, 1970 00:00). | |
Integer |
N |
Returns the system time in nanoseconds (1/1000000000 second intervals since Jan 1, 1970 00:00). | |
Binary | Y | Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data. | |
String | Y | Performs explicit string character encoding conversions. | |
Float |
N |
Returns the cosine of the number in radians passed. | |
Float |
N |
Returns the hyperbolic cosine of the number passed. | |
Date | N | Converts the argument passed to a date. | |
Date | N | Converts an integer argument as a millisecond offset from January 1, 1970 to a date. | |
Date |
N |
Returns a relative date in days for date arithmetic. | |
n/a |
N |
Deletes all keys in the thread-local data hash. | |
n/a | N | Deletes the data associated to one or more keys in the thread-local data hash (destroys any objects as well). | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for the DES algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for the DES algorithm. | |
String |
Y |
Decrypts data using the Cipher Block Chaining function for the DES algorithm. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for the two-key triple DES algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for the two-key triple DES algorithm. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for the three-key triple DES algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for the three-key triple DES algorithm. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for RSA's DESX algorithm. | |
String |
Y |
Encrypts data to a string using the Cipher Block Chaining function for RSA's DESX algorithm. | |
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) | |
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) | |
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) | |
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) | |
Integer | N | Returns the value of the system "errno" variable, holding the last error code generated by a system call | |
n/a | N | Replaces the current process image with another. | |
Boolean |
N |
Returns True if the function exists in the current program's function name space. | |
N/A |
N |
Exits the program | |
Float |
N |
Returns the value of e raised to the power of the argument passed | |
Float |
N |
Returns the value of 2 raised to the power of the argument passed | |
Float |
N |
Returns an equivalent of exp(x) - 1 | |
String |
Y |
"field" printf, field width specifiers are respected. Returns string printed. | |
String |
Y |
"field" sprintf(), field width specifiers are respected | |
Float |
N |
Returns the argument converted to a floating-point number | |
Float | N |
Returns a value rounded down to the nearest integer | |
n/a | N | Flushes output to the console output with print(), printf(), etc | |
String | 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. | |
Integer | N |
Creates a duplicate of the current process | |
String | N |
Allows dates to be formatted | |
String | N |
Allows numbers to be formatted with more options than sprintf() | |
String |
N |
Returns "builtin", "user", or NOTHING according to the function name passed | |
Hash |
N |
Returns the entire thread data hash. | |
Integer |
N |
Returns an integer value representing the days value of the date passed (can be either a relative or absolute date). | |
String |
N |
Returns the name of the default character encoding for the Qore library. | |
String |
N |
Returns a string describing the character encoding of the string passed. | |
Integer |
N |
Returns an integer value representing the hours value of the date passed (can be either a relative or absolute date). | |
Date |
N |
Returns a date/time value representing midnight on the date passed (strips the time from the date passed and returns the new value) | |
Integer |
N |
Returns an integer value representing the milliseconds value of the date passed (can be either a relative or absolute date). | |
Integer |
N |
Returns an integer value representing the minutes value of the date passed (can be either a relative or absolute date). | |
Integer |
N |
Returns an integer value representing the months value of the date passed (can be either a relative or absolute date). | |
Hash | N | Returns a hash of build and version information for the qore library. | |
List | N | Returns a list of hashes giving information about qore library options. | |
Integer | N | Returns an integer value representing the seconds value of the date passed (can be either a relative or absolute date). | |
String | N | Returns a string giving the path (directory and filename) from which the current script was executed (if known). | |
String | N | Returns a string giving the directory from which the current script was executed (if known). | |
String | N | Returns a string giving the filename of the current script (if known). | |
Any |
N |
Returns the value of the thread-local data attached to the key passed | |
Integer |
N |
Returns an integer value representing the years value of the date passed (can be either a relative or absolute date). | |
Hash |
N | Returns a hash of call stacks keyed by each TID (thread ID). | |
Integer | N | Returns the byte value withing the string or binary object passed. | |
String | N | Returns the class name of the object passed. | |
String | N | Returns the name of the current working directory. | |
Date |
N |
Retuns an absolute date value for the ISO-8601 calendar week information passed (year, week number, optional: day) | |
Integer |
N |
Returns an integer representing the day of the week for the absolute date passed (0=Sunday, 6=Saturday) | |
Integer |
N |
Returns an integer representing the ordinal day number in the year for the absolute date passed | |
Integer | N | Returns an integer representing the capabilities of a DBI driver. | |
List | N | Returns a list of codes representing the capabilities of a DBI driver. | |
List | N | Returns a list of strings of DBI drivers currently available. | |
Int |
N |
Returns the effective group ID of the current process. | |
Int |
N |
Returns the effective user ID of the current process. | |
List |
N |
Returns a list of strings of the builtin and module-supplied features of Qore. | |
String |
N |
Retrieves the value of an environment variable | |
Int |
N |
Returns the real group ID of the current process. | |
String | N | Returns the official hostname corresponding to the network addressed passed | |
Hash | N | Returns all host information corresponding to the network address | |
String | N | Returns the first network address corresponding to the hostname | |
Hash | N | Returns all host information corresponding to the hostname | |
String | N | Returns the hostname of the system | |
Integer |
N |
Returns an integer representing the ISO-8601 day of the week for the absolute date passed (1=Monday, 7=Sunday) | |
Hash |
N |
Returns a hash representing the ISO-8601 calendar week information for the absolute date passed (hash keys: year, week, day) | |
String |
N |
Returns a string representing the ISO-8601 calendar week information for the absolute date passed (ex: 2006-01-01 = "2005-W52-7") | |
List |
N |
Returns a list of strings of the names of the methods of the class of the object passed as a parameter. | |
List |
N |
Returns a list of hashes describing the currently-loaded Qore modules. | |
Int |
N |
Returns the PID (process ID) of the current process. | |
Int | N | Returns the parent PID of the current process. | |
Hash |
N |
Returns a hash representing the user information of the user ID passed. | |
Int |
N |
Returns the Qore thread ID (TID) of the current thread. | |
Int |
N |
Returns the real user ID of the current process. | |
List |
N |
Returns a list of files matching the string argument | |
Date | N |
Returns a date/time value in GMT | |
Binary | N | Uncompresses data compressed with the "gzip" algorithm (RFC 1952) using zlib functions and returns a binary object. | |
String | N | Uncompresses data compressed with the "gzip" algorithm (RFC 1952) using zlib functions and returns a string. | |
Binary | Y | Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data. | |
Hash |
N |
Converts an object or a list to a hash; otherwise returns an empty hash. | |
List |
N |
Returns a list of all the values in the hash argument passed. | |
Integer | N | Returns an integer for a hexadecimal string value. | |
Hash | N | Returns a hash of information about the file corresponding to the pathname argument; does not follow symbolic links (returns information about symbolic links). | |
Date |
N |
Returns a relative date in hours to be used in date arithmetic. | |
Hash | N | Returns a hash of information about the file corresponding to the pathname argument; follows symbolic links. | |
String |
Y |
Returns a string with any HTML escape codes translated to the original characters | |
String |
Y |
Returns a string with any characters that can be escaped translated to HTML escape codes. | |
Float |
N |
Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments. | |
Int | N | Returns the character position of a substring within a string and takes an optional starting offset | |
Boolean | N | Returns True if the first argument is a member of the second argument list using comparisons with type conversions. | |
Boolean | N | Returns True if the first argument is a member of the second argument list using comparisons without type conversions. | |
Int |
N |
Returns the argument converted to an integer | |
Boolean |
N |
Returns True if the string passed identifies a block device file on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a character device file on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a device file (either block or character) on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a directory on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies an executable file. | |
Boolean |
N |
Returns True if the string passed identifies a regular file on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a symbolic link on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a pipe (FIFO) on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a file readable by the current user. | |
Boolean |
N |
Returns True if the string passed identifies a socket on the filesystem. | |
Boolean |
N |
Returns True if the string passed identifies a file writable by the current user. | |
String |
N |
Creates a string from a list and separator character | |
Int |
N |
Sends a signal to a process (default: SIGHUP) | |
String | N | Changes the user and group owners of a file (if the current user has permission to do so), does not follow symbolic links. | |
Int |
N |
Returns the length in characters for the string passed. | |
List |
N |
Returns a list with the argument passed as the first element (or an empty list if no argument is passed) | |
n/a | Y | Loads a Qore module at run-time if the feature name is not already present in the current Program object. | |
Date |
N |
Returns a date value in localtime based on the value of the argument passed, which must be the number of seconds after Jan 1, 1970, 00:00:00 | |
Float |
N |
Returns the base 10 logarithm of the value passed | |
Float |
N |
Returns the natural logarithm of the value passed plus 1 | |
Float |
N |
Returns the exponent of a number. | |
List |
N |
Returns a list of filesystem values for the file or symbolic link passed. | |
String | N | Returns a base64-encoded representation of a binary object or a string. | |
String |
Y |
Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability. | |
String |
Y |
Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability. | |
String |
Y |
Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability. | |
String |
Y |
Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability. | |
String |
Y |
Serializes qore data into a JSON string, formatted with line breaks for easier readability. | |
String |
Y |
Serializes a hash into an XML string with formatting and without an XML header. | |
String | Y | Serializes the arguments into an XML string for an XML-RPC call with formatting. | |
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. | |
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. | |
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. | |
String | Y | Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting. | |
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. | |
String | Y | Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting. | |
String | 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. | |
String |
Y |
Serializes the arguments into an XML string in XML-RPC Value format with whitespace formatting. | |
String |
Y |
Serializes a hash into an XML string with formatting and an XML header. | |
String | N | Returns a hex-encoded representation of a binary object or a string. | |
String |
Y |
Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks. | |
String |
Y |
Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks. | |
String |
Y |
Creates a JSON-RPC request string from the parameters passed, without any line breaks. | |
String |
Y |
Creates a JSON-RPC response string from the parameters passed, without any line breaks. | |
String |
Y |
Serializes qore data into a JSON string, without any line breaks. | |
String |
Y |
Serializes a hash into an XML string without an XML header or formatting. | |
String | Y | Serializes the arguments into an XML string formatted for an XML-RPC call without formatting. | |
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. | |
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. | |
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. | |
String | Y | Serializes the arguments into an XML string formatted for an XML-RPC fault response without formatting. | |
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. | |
String | Y | Serializes the arguments into an XML string formatted for an XML-RPC response without formatting. | |
String | 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. | |
String |
Y |
Serializes the arguments into an XML string in XML-RPC Value format without formatting. | |
String | Y | Serializes a hash into a complete XML string with an XML header and without formatting. | |
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. | |
String |
Y |
Returns the MD2 message digest of the supplied argument as a hex string (for strings, the trailing null character is not included in the digest) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
Date | N | Returns a relative date in milliseconds to be used in date arithmetic. | |
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. | |
Date |
N |
Returns a relative date in minutes to be used in date arithmetic. | |
Int |
Y |
Creates a directory. | |
Int |
N |
Creates a named pipe | |
Int | N |
Returns the number of seconds after Jan 1, 1970, 00:00:00, assuming that the date passed is in local time | |
Date | N | Returns a relative date in months to be used in date arithmetic. | |
Float | N | Returns the natural logarithm of the value passed | |
Date | N | Returns current date and time with resolution to the second | |
Date | N | Returns current date and time with resolution to the millisecond | |
Int |
N |
Returns the current number of threads in the process | |
Int |
N |
Gives the numeric value of the character passed | |
n/a |
Y |
Adds the text passed to the current program's code | |
Binary | Y | Parses a base64 encoded string and returns the binary object | |
Hash | N | Returns a hash of the components of a datasource string. | |
Binary | Y | Parses a hex-encoded string and returns the binary object | |
Qore Data |
N |
Parses a JSON string and returns the corresponding qore data structure. | |
Hash |
Y | Parses a URL string and returns a hash of the components. | |
Hash | Y | parses an XML string and returns a Qore hash structure. | |
Hash | Y | parses an XML string, validates the generated XML against a RelaxNG schema string, and returns a Qore hash structure. | |
Hash | Y | parses an XML string, validates the generated XML against an XSD schema string, and returns a Qore hash structure. | |
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) and returns a Qore hash structure. | |
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. | |
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. | |
Hash |
Y | deserializies an XML-RPC call string, returning a Qore data structure representing the call information. | |
Hash |
Y | deserializies an XML-RPC response string, returning a Qore data structure representing the response information. | |
Hash |
Y | deserializies an XML-RPC value tree, returning a Qore data structure representing the information. | |
Float |
Y |
Returns the value of the first argument raised to the power of the second | |
- |
Y |
Prints the string passed without any formatting. | |
String |
Y |
Prints a formatted string and returns string printed. | |
Float | N | Returns a random integer number. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for RSA's RC2(tm) algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for RSA's RC2(tm) algorithm. | |
Binary |
Y |
Encrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm. | |
Binary |
Y |
Decrypts data using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm. | |
String |
Y |
Decrypts data to a string using the Alleged RC4 cipher algorithm, which should be compatible with RSA's RC4(tm) algorithm. | |
Binary |
Y |
Encrypts data using the Cipher Block Chaining function for RSA's RC5(tm) algorithm. | |
Binary |
Y |
Decrypts data using the Cipher Block Chaining function for RSA's RC5(tm) algorithm. | |
String |
Y |
Decrypts data to a string using the Cipher Block Chaining function for RSA's RC5(tm) algorithm. | |
Boolean | Y | Returns true if the regular expression matches the string passed | |
String | Y | Returns a list of substrings in a string based on matching patterns defined by a regular expression. | |
String | Y | Returns a string with patterns substituted according to the arguments passed. | |
n/a | N | Removes an installed signal handler and returns the signal handling state to the default. | |
n/a | N | Removes the listed keys from the thread-local data hash. | |
n/a | Y | Renames (or moves) a file or directory. | |
String |
N |
Replaces all occurrances of a substring in a string with another string and returns the new string. | |
String or List | N | Reverses the order of a string or a list and returns the new string or list. | |
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) | |
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) | |
Int |
N |
Returns the starting character position of a string in another string as searched from the end of the string. | |
Int |
Y |
Removes a directory. | |
Float | N | Returns a value rounded up to the nearest integer integer. | |
- |
Y |
Saves the data passed against the key passed in thread-local storage. | |
Date | N | Returns a relative date/time value in seconds to be used in date arithmetic. | |
n/a | N | Installs or replaces a signal handler. | |
Integer |
Y |
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()) | |
Integer |
Y |
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()) | |
String |
N |
Sets the value of an environment variable | |
Integer |
Y |
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()) | |
Integer |
Y |
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()) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
Int |
N |
Causes the current thread to sleep for a certain number of seconds. | |
List | 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. | |
List | 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. | |
List | 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. | |
List | 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. | |
List |
N |
Splits a string into a list of components based on a separator string | |
String |
Y |
Creates a string from the format argument passed and the other arguments. | |
Float |
N |
Returns the sine of the number in radians passed. | |
Float |
N |
Returns the hyperbolic sine of the number passed. | |
Float |
N |
Returns the square root of the number passed. | |
n/a |
N |
Seeds the random number generator with the integer passed. | |
List |
N |
Returns a list of filesystem information for the filename passed. | |
String |
N |
Returns the description of the error number passed | |
String |
N |
Returns the argument converted to a string | |
Int |
N |
Returns the number of characters in a string | |
Integer | N | Returns an integer corresponding to the string passed with the possibility to specify the base (default base 10). | |
String |
N |
Returns a substring of a string | |
Int |
Y |
Executes a process and returns the return code | |
Float |
N |
Returns the tangent of the number in radians passed. | |
Float |
N |
Returns the hyperbolic tangent of the number passed. | |
List | N | Returns a list of all current thread IDs | |
n/a | Y | Immediately runs all thread resource cleanup routines for the current thread and throws all associated exceptions. | |
Date |
N |
Returns the number of seconds since January 1, 1970 00:00 for a given date in GMT. | |
String |
N |
Converts a string to all lowercase | |
String |
N |
Converts a string to all uppercase | |
String | 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 variable references to do modifications in-place. | |
Int |
N |
Returns the data type of the argument passed (see Type_Constants) | |
String |
N |
deprecated: use type() instead | |
Int |
N |
Sets the file creation mask for the process | |
Binary | N | Uncompresses (inflates) data compressed with the "deflate" algorithm (RFC 1951) using zlib functions and returns a binary object. | |
String | N | Uncompresses (inflates) data compressed with the "deflate" algorithm (RFC 1951) using zlib functions and returns a string. | |
Int |
N |
Deletes a file and returns 0 for success. | |
n/a | N | Unsets an environment variable | |
Int | N | Causes the current thread to sleep for a certain number of microseconds | |
String |
Y |
Outputs a formatted string based on a variable number of arguments given in a list after the format string. Returns the string printed. | |
String |
Y |
Formats a string based on a variable number of arguments given in a list after the format string and returns this formatted string. | |
Date |
N |
Returns a relative date/time value in years to be used in date arithmetic. |
Returns the absolute value of the argument passed.
abs(numeric_expression
)
$x = abs($y);
Table 3.3. Arguments and Return Values for abs()
Argument Type | Return Type | Description |
---|---|---|
Integer | Integer | Absolute value of the integer passed. |
Float | Float | Absolute value of the floating-point value passed. |
This function does not throw any exceptions.
Returns the arc cosine of the number passed in radians
acos(float
)
$x = acos($y);
Table 3.4. Arguments and Return Values for acos()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the arc cosine of the number passed in radians. |
This function does not throw any exceptions.
Returns the arc sine of the number passed in radians
asin(float
)
$x = asin($y);
Table 3.5. Arguments and Return Values for asin()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the arc sine of the number passed in radians. |
This function does not throw any exceptions.
Returns the arc tangent of the number passed in radians
atan(float
)
$x = atan($y);
Table 3.6. Arguments and Return Values for atan()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the arc tangent of the number passed in radians. |
This function does not throw any exceptions.
Returns the cube root of the number passed.
cbrt(float
)
$x = cbrt($y);
Table 3.7. Arguments and Return Values for cbrt()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the cube root of the number passed. |
This function does not throw any exceptions.
Returns a floating-point number equal to the smallest integral value greater than or equal to the argument passed.
ceil(float
)
$x = ceil(3.2); # will return 4.0
Table 3.8. Arguments and Return Values for ceil()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns a value rounded up to the nearest integral floating-point value. |
This function does not throw any exceptions.
Returns the cosine of the number in radians passed.
cos(float
)
$x = cos($y);
Table 3.9. Arguments and Return Values for cos()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the cosine of the number in radians passed. |
This function does not throw any exceptions.
Returns the hyperbolic cosine of the number in radians passed.
cosh(float
)
$x = cosh($y);
Table 3.10. Arguments and Return Values for cosh()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the hyperbolic cosine of the number in radians passed. |
This function does not throw any exceptions.
Returns the value of e raised to the power of the argument passed.
exp(float
)
$x = exp($y);
Table 3.11. Arguments and Return Values for exp()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the value of e raised to the power of the argument passed. |
This function does not throw any exceptions.
Returns the value of 2 raised to the power of the argument passed.
exp2(float
)
$x = exp2($y);
Table 3.12. Arguments and Return Values for exp2()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the value of 2 raised to the power of the argument passed. |
This function does not throw any exceptions.
Returns an equivalent of exp(x) - 1.
expm1(float
)
$x = expm1($y);
Table 3.13. Arguments and Return Values for expm1()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns an equivalent of exp(x) - 1. |
This function does not throw any exceptions.
Returns a floating-point value rounded down to the integral value.
floor(float
)
$x = floor(3.7); # will return 3.0
Table 3.14. Arguments and Return Values for floor()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns a float-point value rounded down to the integral value. |
This function does not throw any exceptions.
Returns a string of a formatted number according to the arguments passed.
format_number(format_string, number
)
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.
format_number(".,3", -48392093894.2349); # returns "-48.392.093.894,235"
Table 3.15. Arguments and Return Values for format_number()
Argument Types | Return Type | Description |
---|---|---|
String, Float | String | Returns a string corresponding to a number according to the formatting string passed. |
This function does not throw any exceptions.
Returns the length of the hypotenuse of a right-angle triangle with sides given as the two arguments.
hypot(float_x, float_y
)
$z = hypot($x, $y);
Table 3.16. Arguments and Return Values for hypot()
Argument Type | Return Type | Description |
---|---|---|
Float | 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.
Returns the base 10 logarithm of the value passed.
log10(float
)
$x = log10($y);
Table 3.17. Arguments and Return Values for log10()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the base 10 logarithm of the value passed. |
This function does not throw any exceptions.
Returns the natural logarithm of the value passed plus 1.
log1p(float
)
$x = log1p($y);
Table 3.18. Arguments and Return Values for log1p()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the natural logarithm of the value passed plus 1. |
This function does not throw any exceptions.
Returns the exponent of a number.
logb(float
)
$x = logb($y);
Table 3.19. Arguments and Return Values for logb()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the exponent of a number. |
This function does not throw any exceptions.
Returns the natural logarithm of the value passed.
nlog(float
)
$x = nlog();
Table 3.20. Arguments and Return Values for nlog()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the natural logarithm of the value passed. |
This function does not throw any exceptions.
Returns a number raised to the power of another number.
pow(x, y
)
$z = pow($x, $y);
Table 3.21. Arguments and Return Values for pow()
Argument Types | Return Type | Description |
---|---|---|
Float | Float | Returns x raised to the power of y. |
Table 3.22. Exceptions Thrown by pow()
err | desc |
---|---|
| pow(x, y): y must be a non-negative value. |
| pow(x, y): x cannot be negative when y is not an integer value. |
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.
round(float
)
$x = round(3.2); # returns 3.0
Table 3.23. Arguments and Return Values for round()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns a value rounded to the nearest integral floating-point value, half-way cases are rounded away from zero. |
Table 3.24. Exceptions Thrown by round()
err | desc |
---|---|
| This exception is thrown when the function is not available; for maximum portability, check the constant |
Returns the sine of the number in radians passed.
sin(float
)
$x = sin($y);
Table 3.25. Arguments and Return Values for sin()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the sine of the number in radians passed. |
This function does not throw any exceptions.
Returns the hyperbolic sine of the number in radians passed.
sinh(float
)
$x = sinh($y);
Table 3.26. Arguments and Return Values for sinh()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the hyperbolic sine of the number in radians passed. |
This function does not throw any exceptions.
Returns the square root of the number passed.
sqrt(float
)
$x = sqrt($y);
Table 3.27. Arguments and Return Values for sqrt()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the square root of the number passed. |
This function does not throw any exceptions.
Returns the tangent of the number in radians passed.
tan(float
)
$x = tan($y);
Table 3.28. Arguments and Return Values for tan()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the tangent of the number in radians passed. |
This function does not throw any exceptions.
Returns the hyperbolic tangent of the number in radians passed.
tanh(float
)
$x = tanh($y);
Table 3.29. Arguments and Return Values for tanh()
Argument Type | Return Type | Description |
---|---|---|
Float | Float | Returns the hyperbolic tangent of the number in radians passed. |
This function does not throw any exceptions.