Many functions in Phi are based directly on PHP functions of the same name, so the links below link to the function description on PHP.net.
The following general purpose functions are available in Phi:
(number)
returns number
Returns the absolute value of a number.
(number)
returns radians
Returns the arc cosine (in radians) of the input.
(number)
returns number
Returns the inverse hyperbolic cosine of the input.
(numbers/strings)
returns array
This combines its inputs together into an array.
(arrays)
returns array
This merges two or more arrays together into one array.
(number)
returns radians
Returns the arc sine (in radians) of the input.
(number)
returns number
Returns the inverse hyperbolic sine of the input.
(number)
returns radians
Returns the arc tangent (in radians) of the input.
(number)
returns number
(number)
returns number
Returns the inverse hyperbolic tangent of the input.
(number, frombase, tobase)
returns string
Converts a number between bases. E.g. base_convert('17', 8, 10) == 15
(binary-string)
returns number
Converts a binary string to a number. E.g. base_convert('101') == 5
(numbers/strings)
returns array
An alias of array()
, this combines its inputs together into an array.
(number)
returns number
Rounds a float up to the nearest integer value.
(radians)
returns number
Returns the cosine of the input, which needs to be in radians.
(number)
returns number
Returns the hyperbolic cosine of the input.
(array)
returns number
Counts the number of elements in an array.
(array, index)
returns element
Returns an element from an array at the specified index. If the specified index is too high then it will wrap round back to the start of the array.
(number)
returns binary-string
Converts an integer into a binary string, e.g. decbin(5) == '101'
.
(number)
returns hexadecimal-string
Converts an integer into a hexadecimal string, e.g. dechex(15) == 'F'
.
(number)
returns octal-string
Converts an integer into an octal string, e.g. decoct(15) == '17'
.
(degrees)
returns radians
Converts an an in degrees into a number in radians.
(number)
returns number
Returns the factorial of the number entered.
(array/numbers)
returns number
Returns the first or lower quartile of the numbers entered.
(mixed)
returns number
Converts an integer or a string to a floating point number if possible.
(number)
returns number
Rounds a float down to the nearest integer value.
(number, number)
returns number
Returns the greatest common divider of two integers.
(hexadecimal-string)
returns number
Converts a hexadecimal string into an integer, e.g. hexdec('F') == 15
.
(mixed)
returns number
Converts a floating point number or a string to an integer if possible.
(number)
returns boolean
Checks whether a float is finite.
(number)
returns boolean
Checks whether a float is infinite.
(number)
returns boolean
Checks for floats marked as "non a number", e.g. is_nan(sqrt(-1))
.
(number, number)
returns number
Returns the least common multiple of two integers.
(array/string)
returns number
Returns the length of a string, or the number of elements in an array.
(numbers/strings)
returns array
An alias of array()
, this combines its inputs together into an array.
(number[, base])
returns number
Calculates a logarithm.
(number)
returns number
Calculates the base-10 logarithm of the input.
(array/numbers)
returns number
Returns the first or lower quartile of the numbers entered.
(array/numbers)
returns number
Returns the largest of the numbers entered.
(array/numbers)
returns number
Returns the mean of the numbers entered.
(array/numbers)
returns number
Returns the median of the numbers entered.
(array/numbers)
returns number
Returns the smallest of the numbers entered.
(array/numbers)
returns number
Returns the most common value from the numbers entered.
(octal-string)
returns number
Converts an octal string into an integer, e.g. octdec('17') == 15
.
(strings)
returns string
Concatenates strings together, joining them together with a space between each.
(string)
returns null
This allows you to check the value of variables while testing your code. The data processor ignores this function.
(array/numbers)
returns number
Returns the product of the numbers entered.
(radians)
returns degrees
Converts an an in degrees into a number in radians.
(array/number/string)
returns element/number/character
Returns a random element from an array, a random character from a string, or a random integer less than or equal to the number provided.
(start, stop[, step])
returns array
Generates an array of integers.
()
Call this to end the current Phi script. Any code after this will not be run.
Note that this is a function, so you need to include the brackets when calling it.
(array/numbers/strings)
returns array
An alias of reverse
, this returns an array with the inputs in reverse order.
(array/numbers/strings)
returns array
This returns an array with the inputs in reverse order.
(number[, precision])
returns number
Rounds the input to the specified number of decimal places.
(array/numbers/strings)
returns array
This makes a randomly shuffled array from the inputs.
(radians)
returns number
Returns the sine of the input, which needs to be in radians.
(number)
returns number
Returns the hyperbolic sine of the input.
(array/numbers/strings)
returns array
This makes a sorted array from the inputs.
(number)
returns number
Returns the square root of the input.
(array/numbers)
returns number
Returns the standard deviation of the numbers entered.
(mixed)
returns string
Converts a number to a string.
(array/numbers)
returns number
Returns the total of the numbers entered.
(radians)
returns number
Returns the tangent of the input, which needs to be in radians.
(number)
returns number
Returns the hyperbolic tangent of the input.
(array/numbers)
returns number
Returns the third or upper quartile of the numbers entered.
(string)
returns string
Strips whitespace from the beginning and end of a string.
(array/numbers)
returns number
Returns the third or upper quartile of the numbers entered.