PHP Articles

Page 76 of 81

rad2deg() function in PHP

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

The rad2deg() function converts radian values to degree values. It returns the equivalent of a radian value in degrees, making it useful for mathematical calculations and geometric computations. Syntax rad2deg(val) Parameters val − The radian value to be converted into degrees. This should be a numeric value representing an angle in radians. Return Value The rad2deg() function returns the equivalent of the input value in degrees as a float. Example 1: Converting Pi Radians Converting π radians (180 degrees) to degrees − ...

Read More

pow() function in PHP

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

The pow() function in PHP calculates the power of a number by raising the base to the specified exponent. It handles positive, negative, and floating-point values. Syntax pow(base, exponent) Parameters base − The base number (can be integer or float) exponent − The exponent to raise the base to (can be integer or float) Return Value Returns the result of base raised to the power of exponent. Returns NAN for invalid operations like negative base with fractional exponent. Example 1: Basic Power Calculation Calculate 3 raised to the ...

Read More

pi() function in PHP

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

The pi() function returns the value of Pi (π), which is approximately 3.1415926535898. This mathematical constant represents the ratio of a circle's circumference to its diameter. Syntax pi() Parameters The pi() function takes no parameters. Return Value Returns the approximate value of PI as a floating-point number: 3.1415926535898. Example Here's a basic example using the pi() function − 3.1415926535898 Using M_PI Constant PHP also provides the M_PI predefined constant as an alternative to the pi() function − ...

Read More

octdec() function in PHP

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

The octdec() function converts an octal number to its decimal equivalent. This function is useful when working with octal representations in PHP. Syntax octdec(octal_string) Parameters octal_string − A string containing the octal number to convert. Can include negative sign for negative numbers. Return Value The octdec() function returns the decimal equivalent of the specified octal number as an integer. Example 1: Basic Octal to Decimal Conversion Here's how to convert a simple octal number to decimal − 80 120 Example ...

Read More

mt_srand() function in PHP

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

The mt_srand() function seeds the Mersenne Twister random number generator in PHP. This function allows you to initialize the random number generator with a specific seed value, ensuring reproducible random number sequences. Note − Random number generator is seeded automatically after the release of PHP 4.2.0. This function is not needed now unless you want predictable random sequences. Syntax mt_srand(seed) Parameters seed − Optional integer value used to initialize the random number generator. If omitted, a random seed is used. Return Value The mt_srand() function ...

Read More

min() function in PHP

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

The min() function in PHP returns the minimum value from a given set of values or an array. It compares all provided values and returns the smallest one. Syntax min(arr_values); or min(val1, val2, ...); Parameters arr_values − An array containing the values to compare. val1, val2, ... − Individual values to compare (can pass multiple arguments). Return Value Returns the minimum value from the provided arguments or array. The return type matches the type of the smallest value. Example 1: Using ...

Read More

max() function in PHP

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

The max() function in PHP returns the maximum value from a set of values or an array. It accepts either multiple individual values or a single array as input. Syntax max(value1, value2, value3, ...) max(array_values) Parameters value1, value2, ... − Individual values to compare (can be numbers or strings). array_values − An array containing values to compare. Return Value Returns the maximum value found. For string comparisons, it uses lexicographical ordering. Example 1: Using Multiple Values Finding the maximum among individual numeric values − ...

Read More

log1p() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 169 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 275 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 132 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
Showing 751–760 of 802 articles
« Prev 1 74 75 76 77 78 81 Next »
Advertisements