Server Side Programming Articles

Page 1064 of 2109

log1p() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 193 Views

The log1p() function in PHP returns log(1+number), computed in a way that is accurate even when the value of number is close to zero. This function is particularly useful for mathematical calculations involving logarithms of values near zero, where direct calculation of log(1+x) might lose precision. Syntax log1p(number) Parameters number − The numeric value to be processed. Must be greater than -1. Return Value Returns the natural logarithm of (1 + number) as a float. If the number is less than or equal to -1, the function returns NAN (Not ...

Read More

log() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 298 Views

The log() function in PHP calculates the natural logarithm (base e) of a number. It can also calculate logarithms with a specified base when provided as the second parameter. Syntax log(number, base) Parameters number − The value for which you want to calculate the logarithm (must be positive) base − Optional. The logarithmic base. If omitted, calculates natural logarithm (base e) Return Value Returns the logarithm of the number. Returns -INF for zero, NAN for negative numbers, and a float value for positive numbers. Examples Basic Natural Logarithm ...

Read More

is_nan() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 143 Views

The is_nan() function checks for 'not a number' value. It returns TRUE if the value is 'not a number', else FALSE is returned. Syntax is_nan(num) Parameters num − The value to check Return Value The is_nan() function returns TRUE if num is 'not a number', else FALSE is returned. Example 1 Here's a simple example checking if a number is NaN − false Example 2 Let us see another example with acos() function − ...

Read More

is_infinite() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 152 Views

The is_infinite() function checks if a value is infinite or not. It returns true if the number is an infinite number, else it returns false. Syntax is_infinite(num) Parameters num − The number to be checked. Return Value The is_infinite() function returns true if num is an infinite number, else it returns false. Example 1: Finite Number Let's check if a regular number is infinite ? false Example 2: Infinite Number Here we use log(0) which produces negative infinity ? ...

Read More

is_finite() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 127 Views

The is_finite() function checks if a value is finite or not. It returns true if the number is a finite number, else it returns false. Syntax is_finite(num) Parameters num − The number to be checked. Return Value The is_finite() function returns true if num is a finite number, else it returns false. Example 1: Finite Number Let's check if a regular number is finite ? true Example 2: Infinite Value Let's check if log(0) (which is negative infinity) is ...

Read More

hypot() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 159 Views

The hypot() function is used to calculate the hypotenuse of a right-angle triangle. It returns the length of the hypotenuse as a float. In a right-angled triangle, the hypotenuse is the longest side opposite to the right angle. a b hypotenuse Syntax hypot(a, b) Parameters a − Length of first side (numeric value) b − Length of second side (numeric value) Return Value The hypot() function returns the length of the hypotenuse as a float ...

Read More

fmod() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 286 Views

The fmod() function returns the floating-point remainder (modulo) of dividing two numbers. Unlike the modulo operator (%), fmod() handles floating-point numbers and returns a float result. Syntax fmod(dividend, divisor) Parameters dividend − The number to be divided. divisor − The number that divides the dividend. Return Value The fmod() function returns the floating-point remainder of dividend/divisor. If the divisor is zero, it returns NAN (Not a Number). Example Here's a basic example demonstrating fmod() with integers ? fmod(30, 9) = 3 ...

Read More

floor() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 221 Views

The floor() function rounds a number down to the nearest integer. It always rounds towards negative infinity, which means positive decimals are rounded down and negative decimals are rounded further away from zero. Syntax floor(num) Parameters num − The number to round down Return Value The floor() function returns the value rounded down to the nearest integer as a float. Example 1 Basic usage with positive decimal numbers − 0 0 9 Example 2 Using floor() with whole numbers ...

Read More

expm1() function in PHP

Samual Sam
Samual Sam
Updated on 15-Mar-2026 129 Views

The expm1() function returns e raised to the power x minus 1, which is mathematically represented as ex - 1. This function is particularly useful for calculating values close to zero with higher precision than using exp(x) - 1. Syntax expm1(number) Parameters number − A floating point value representing the exponent Return Value Returns a float representing ex - 1, where e is Euler's number (approximately 2.718281828). Example 1 Basic usage of expm1() with different values − expm1(0) = 0 expm1(1) = ...

Read More

exp() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 139 Views

The exp() function in PHP returns ex, where e is the mathematical constant (approximately 2.718282) raised to the power of x. This function is commonly used in mathematical calculations involving exponential growth, logarithms, and scientific computations. Syntax exp(x) Parameters x − A numeric value representing the exponent. Can be integer, float, or any numeric expression. Return Value Returns a float value representing e raised to the power of x (ex). If the result is too large to represent as a float, the function returns INF (infinity). Basic Examples ...

Read More
Showing 10631–10640 of 21,090 articles
Advertisements