FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
abs()
[Absolute value] |
Returns the positive value of a number. Example: echo abs(-5.3); would output 5.3. |
abs(number); |
If number is a float then the return type is a float. Otherwise the return type is an integer. |
acos()
[Arc cosine] |
Returns the arc cosine of a number. |
acos(number); |
Returns the arc cosine of number, provided that number is in the range -1 to 1. Otherwise it returns NAN. |
acosh()
[Inverse hyperbolic cosine] |
Returns the inverse hyperbolic cosine of a number. |
acosh(number); |
Returns the inverse hyperbolic cosine of number, videlicet – the number whose hyperbolic cosine is number. |
asin()
[Arc sine] |
Returns the arc sine of a number. |
asin(number); |
Returns the arc sine of number, provided that number is in the range -1 to 1. Otherwise it returns NAN. |
asinh()
[Inverse hyperbolic sine] |
Returns the inverse hyperbolic sine of a number. |
asinh(number); |
Returns the inverse hyperbolic sine of number. Return type: float. |
atan()
[Arc tangent] |
Returns the arc tangent of a number in radians. |
atan(number); |
Returns the arc tangent of number as a numeric value between -Pi/2 and Pi/2 radians. Return type: float. |
atan2()
[Arc tangent of two variables] |
Returns the arc tangent of two numbers – x and y.
[Arc tangent of two variables] |
atan2(y, x);
[y specifies the dividend, x specifies the divisor.] |
Returns the arc tangent of y/x in radians, which is a float between -Pi and Pi. |
atanh()
[Inverse hyperbolic tangent] |
Returns the inverse hyperbolic tangent of a number. |
atanh(number); |
Returns the inverse hyperbolic tangent of number. Return type: float. |
base_convert()
[Convert a number between arbitrary bases] |
Converts a number from one number base to another number base. Digits in numbers with a base higher than 10 will be represented by the letters a – z, with a meaning 10, b meaning 11 … and z meaning 35. |
base_convert(number, frombase, tobase);
[Both frombase and tobase have to be between 2 and 36, inclusive.] |
Returns a string containing number represented in base tobase. |
bindec()
[Binary to decimal] |
Converts a binary number to a decimal number. |
bindec(binary_string);
[The parameter value must be a string.] |
Returns the decimal value of binary_string, as a float/integer. |
ceil()
[Round fractions up] |
Rounds a number up to the nearest integer. |
ceil(number); |
Returns number rounded up to the nearest integer. Return type: float. |
cos()
[Cosine] |
Returns the cosine of a number. |
cos(number); |
Returns the cosine of number as a float in the range -1 to 1. |
cosh()
[Hyperbolic cosine] |
Returns the hyperbolic cosine of a number. This is equivalent to (exp(number) + exp(- number))/2. |
cosh(number); |
Returns the hyperbolic cosine of number as a float. |
decbin()
[Decimal to binary] |
Converts a decimal number to a binary number. |
decbin(number); |
Returns a string that represents the binary value of number. |
dechex()
[Decimal to hexadecimal] |
Converts a decimal number to a hexadecimal number. |
dechex(number); |
Returns a string that represents the hexadecimal value of number. |
decoct()
[Decimal to octal] |
Converts a decimal number to an octal number. |
decoct(number); |
Returns a string that represents the octal value of number. |
deg2rad()
[Converts the number in degrees to the radian equivalent] |
Converts a degree value to a radian value. |
deg2rad(number); |
Returns a float representing number converted to radians. |
exp()
[Converts the exponent of ‘e’] |
Returns e [the base of the natural system of logarithms, approximately 2.718282] raised to the power of x (ex). |
exp(x);
[x specifies the exponent]. |
Returns a float representing e raised to the power of x. |
expm1()
[Returns exp(number) - 1 , computed in a way that is accurate even when the value of number is close to zero] |
Returns a number that is one less than exp(x) . |
expm1(x); |
Returns a float representing a number that is one less than e raised to the power of x. |
floor()
[Round fractions down] |
Rounds a number down to the nearest integer. |
floor(number); |
Returns a float that represents number rounded down to the nearest integer. |
fmod()
[Returns the floating point remainder (modulo) of the division of the arguments] |
Returns the remainder [‘modulo’] of x divided by y. |
fmod(x, y);
[x specifies the dividend, y specifies the divisor.] |
Returns a float that represents the remainder of x divided by y. |
getrandmax()
[Shows largest possible random number] |
Returns the largest number that can be returned by rand() , videlicet 32767 [on Windows]. Specifying min and max allows a range larger than 32767 to be created; using mt_rand() to this end should also be considered. |
getrandmax(); |
Returns an integer that represents the largest possible value that can be returned by a call to rand() (i.e. 32767 on Windows). |
hexdec()
[Hexadecimal to decimal] |
Converts a hexadecimal number to a decimal number. |
hexdec(number); |
If the hexadecimal-to-decimal converted number can be represented by the platform’s integer type then an integer is returned; otherwise, a float is returned. |
hypot()
[Calculates the length of the hypoteneuse of a right-angled triangle] |
Calculates the length of the hypoteneuse of a right-angled triangle. This function is equivalent to sqrt(x*x + y*y) . |
hypot(x, y); |
Returns a float representing the length of the hypoteneuse of a right-angled triangle. |
intdiv()
[Integer division] |
Returns the integer quotient of the division of the dividend by the divisor. |
intdiv(dividend, divisor); |
Returns the integer quotient of dividend ÷ divisor. |
is_finite()
[Finds whether a value is a legal finite number] |
Checks whether a value is a legal finite number within the allowed range for a PHP float on this system. |
is_finite(value); |
Boolean return value – true if the value is a legal, finite number within the permitted range for a PHP float on this system; false otherwise. |
is_infinite()
[Finds whether a value is infinite] |
Checks whether a value is infinite. A value is considered infinite if it is outside the allowed range for a float on this platform. |
is_infinite(value); |
Boolean return value – true if the value is considered infinite [not within the permitted range for a PHP float on this system]; false otherwise. |
is_nan()
[Finds whether a value is ‘not a number’] |
Checks whether a value is not a number. |
is_nan(value); |
Boolean return value – true if the value is considered not a number; false otherwise. |
lcg_value()
[Combined linear congruential generator] |
Returns a pseudo random number between 0 and 1. The number generated is not cryptographically secure; random_int() , random_bytes() , or openssl_random_pseudo_bytes() should be used for cryptographic purposes. |
lcg_value(); |
Returns a pseudo random float in the range 0 – 1. |
log10()
[Base-10 logarithm] |
Returns the base-10 logarithm of number. |
log10(number); |
Returns the float representation of the base-10 logarithm of number. |
log1p()
[Returns log(1 + number) , computed in such a way that is accurate even when the value of number is close to zero] |
Returns log(1 + number) computed in a way that is accurate even when number is close to zero. log() might only return log(1) in this case due to lack of precision. |
log1p(number); |
Float representation of the result of log1p(number) . |
log()
[Natural logarithm] |
If the optional base parameter is specified, log() returns logbase(number) ; otherwise, the natural logarithm of number is returned. |
log(number, base);
[number – the value to calculate the logarithm for
base – the optional logarithmic base to use (defaults to ‘e’ and thus to the ‘natural logarithm’)] |
Float return type, representing the logarithm of number to base, if given, or the natural logarithm. |
max()
[Finds the highest value] |
Returns the numerically highest value from the parameters provided to the function.
If the only parameter is an array, the highest value is returned; otherwise, the biggest of the parameter values is returned. |
max(array_values);
OR
max(value1, value2, ...);
|
Returns the numerically highest value passed to the function.
If multiple values of different types evaluate as equal, the first parameter provided to the function will be returned.
If an empty array is passed, FALSE will be returned and an E_WARNING error will be emitted. |
min()
[Finds the lowest value] |
Returns the parameter value considered lowest according to standard comparisons.
If the only parameter is an array, the lowest value is returned; otherwise, the lowest of the parameter values is returned. |
min(array_values);
OR
min(value1, value2, ...);
|
Returns the numerically lowest value passed to the function.
If multiple values of different types evaluate as equal, the first parameter provided to the function will be returned.
If an empty array is passed, FALSE will be returned and an E_WARNING error will be emitted. |
mt_getrandmax()
[Shows the largest possible random number] |
Returns the maximum value that can be returned from a call to mt_rand() without arguments, which is the maximum value that can be used for its max parameter without the result being scaled up. |
mt_getrandmax(); |
Returns an integer representation of the maximum number that can be returned by a call to rand() . |
mt_rand()
[Generates a random number via the Mersenne Twister Random Number Generator] |
If called without the optional min and max arguments a pseudo random number between 0 and mt_getrandmax() is returned. Otherwise, a random number between min and max [inclusive] is returned.
As with lcg_value() , the number generated is not cryptographically secure; random_int() , random_bytes() , or openssl_random_pseudo_bytes() should be used for cryptographic purposes. |
mt_rand();
OR
mt_rand(min, max);
|
Returns a random integer between min (or 0) and max (or mt_getrandmax() , inclusive), or FALSE if max is less than min. |
mt_srand()
[Seeds the Mersenne Twister Random Number Generator] |
mt_srand : Seeds the random number generator with seed (if specified), or with a random value if no seed is given. |
mt_srand(seed [optional], mode [optional]);
[seed specifies an arbitrary integer seed value;
mode specifies the implementation of the algorithm to use] |
No value is returned for mt_srand() . |
octdec()
[Octal to decimal] |
Returns the decimal equivalent of the octal number represented by the octal_string argument. |
octdec(octal_string); |
If the decimal equivalent of the octal_string argument can be represented by the platform’s integer type then an integer is returned; otherwise, a float representation is returned. |
pi()
[Gets the value of ‘pi’] |
Returns an approximation of pi, which has a default precision of 14 (can be altered in the php.ini file). Using the M_PI constant yields identical results to pi() . |
pi(); |
Returns a float representation of pi. |
pow()
[Exponential expression] |
Returns x raised to the power of y.
All input – even non-scalar values – will be converted to a number, which could produce unexpected results. |
pow(x, y);
[x specifies the ‘base’ to use; y specifies the ‘exponent’.] |
Returns x raised to the power of y. If both x and y are non-negative integers and the result can be represented as an integer, an integer type is returned; otherwise, a float type is returned. |
rad2deg()
[Converts the radian number to the equivalent number in degrees] |
This function converts number from radian to degrees. |
rad2deg(number); |
Returns a float representation of number converted to degrees. |
rand()
[Generates a random integer] |
If called without the min, max arguments rand() returns a pseudo-random integer between 0 and getrandmax() . rand(5, 15) returns a number between 0 and 15 [inclusive], for example.
As with lcg_value() , the number generated is not cryptographically secure; random_int() , random_bytes() , or openssl_random_pseudo_bytes() should be used for cryptographic purposes. |
rand();
OR
rand(min, max);
|
Returns a pseudo random integer between min (or 0) and max (or getrandmax() ), inclusive. |
round()
[Rounds a float] |
Returns the rounded value of number to the specified precision [number of digits after the decimal point: default is zero; can also be negative]. |
round(number, precision[optional], mode[optional]);
Mode values:
PHP_ROUND_HALF_UP
PHP_ROUND_HALF_DOWN
PHP_ROUND_HALF_EVEN
PHP_ROUND_HALF_ODD
|
Returns the rounded number as a float. |
sin()
[Sine] |
Returns the sine of number [this parameter is in radians]. |
sin(number); |
Returns the sine of number as a float. |
sinh()
[Hyperbolic sine] |
Returns the hyperbolic sine of number, defined as (exp(number) - exp(-number))/2 . |
sinh(number); |
Returns the hyperbolic sine of number as a float. |
sqrt()
[Square root] |
Returns the square root of number. |
sqrt(number); |
Returns the float representation of the square root of number, or the special value NAN for negative numbers. |
srand()
[Seeds the random number generator] |
Seeds the random number generator with seed or with a random value if no seed is given. |
srand(seed[optional]); |
No value is returned for srand() . |
tan()
[Tangent] |
Returns the tangent of number [this parameter is in radians]. |
tan(number); |
Returns the tangent of number as a float. |
tanh()
[Hyperbolic tangent] |
Returns the hyperbolic tangent of number, defined as sinh(number)/cosh(number) . |
tanh(number); |
Returns the hyperbolic tangent of number as a float. |