Malhar Lathkar

Malhar Lathkar

103 Articles Published

Articles by Malhar Lathkar

Page 10 of 11

PHP hexdec() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 183 Views

The hexdec() function converts a hexadecimal string to its decimal equivalent. This function is useful when working with color codes, memory addresses, or any data represented in hexadecimal format. Syntax hexdec(string $hex_string): int|float Parameters Parameter Description hex_string The hexadecimal string to convert. Can include optional 0x prefix Return Value Returns the decimal representation as an integer or float. Large values may return as float due to integer overflow. Examples Basic Hexadecimal Conversion Converting common hexadecimal values to decimal ?

Read More

PHP getrandmax() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 266 Views

The getrandmax() function returns the largest possible integer that can be used by the rand() function in PHP. This value represents the upper limit for random number generation and is platform-dependent. Syntax getrandmax(): int Parameters This function takes no parameters. Return Value Returns the largest possible integer value that rand() can generate. On most 64-bit systems, this is typically 2147483647. Example Here's how to use getrandmax() to check the maximum random value ? Largest possible random integer: 2147483647 Random number between 0 and max: ...

Read More

PHP floor() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 842 Views

The floor() function is a built-in PHP function that accepts any float number as argument and rounds it down to the next lowest integer. This function always returns a float number as the range of float is bigger than that of integer. Syntax floor ( float $num ) : float Parameters Parameter Description num The number to be rounded down Return Value The floor() function returns the largest integer less than or equal to the given parameter as a float value. Examples Basic Usage ...

Read More

PHP expm1() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 143 Views

The expm1() function calculates ex - 1 in a numerically stable way. It provides better precision than manually computing exp(x) - 1, especially when the value of x is close to zero. Syntax expm1(float $arg) : float Parameters Parameter Description arg A floating point number whose expm1 value is to be calculated Return Value Returns earg - 1 as a floating point number. Examples Basic Usage Here's a simple example demonstrating the expm1() function − expm1(1) = ...

Read More

PHP deg2rad() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 304 Views

The deg2rad() function in PHP converts angles from degrees to radians. This function is essential when working with trigonometric functions like sin(), cos(), and tan(), which require angle arguments in radians rather than degrees. Syntax deg2rad(float $number) : float Parameters Parameter Description number A float number representing angle in degrees Return Value Returns a float number representing the angle in radians. The conversion follows the formula: radians = degrees × π/180. Example Here's how to convert degrees to radians using deg2rad() − ...

Read More

PHP dechex() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 249 Views

The dechex() function converts a decimal number to its hexadecimal representation and returns it as a string. This function is particularly useful for color codes, memory addresses, and low-level programming operations. Syntax dechex ( int $number ) : string Parameters Parameter Description number A decimal number to be converted to hexadecimal representation Return Value Returns a string containing the hexadecimal representation of the given decimal number. Example 1: Basic Usage Converting positive decimal numbers to hexadecimal ? a ...

Read More

PHP decbin() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 300 Views

The decbin() function converts a decimal number to its binary representation and returns it as a string. This function is useful for displaying numbers in binary format or for bitwise operations. Syntax decbin ( int $number ) : string Parameters Parameter Description number A decimal number to be converted to binary representation Return Value Returns a string containing the binary representation of the given decimal number. Examples Basic Usage Here's how to convert positive decimal numbers to binary ? ...

Read More

PHP cos() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 394 Views

The cos() function returns the cosine ratio of given angle in radians. In trigonometry, cosine of an angle is defined as ratio of lengths of adjacent side and hypotenuse. cos(x) = adjacent/hypotenuse If x=90 degrees (π/2 radians), cos(x) = 0. This function returns a float value. Syntax cos ( float $arg ) : float Parameters Parameter Description arg A floating point value that represents angle in radians Return Value PHP cos() function returns cosine ratio of given parameter as a float. Examples ...

Read More

PHP ceil() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 408 Views

The ceil() function is a built-in mathematical function in PHP that rounds any float number up to the next highest integer. This function always returns a float number, as the range of float is larger than that of integer. Syntax ceil ( float $num ) : float Parameters Parameter Description num The number to be rounded up Return Value The ceil() function returns the smallest integer value (as float) that is greater than or equal to the given parameter. Examples Example 1: Basic Usage ...

Read More

PHP bindec() Function

Malhar Lathkar
Malhar Lathkar
Updated on 15-Mar-2026 270 Views

The bindec() function converts a binary number represented as a string into its decimal equivalent. The binary string is interpreted as an unsigned integer, and invalid characters (other than 0 and 1) are ignored. Syntax bindec(string $binary_string): int|float Parameters Parameter Description binary_string A string containing binary digits (0 and 1). Invalid characters are ignored. Return Value Returns the decimal equivalent as an integer or float (for large numbers). Examples Basic Usage Converting a simple binary string to decimal ? ...

Read More
Showing 91–100 of 103 articles
« Prev 1 7 8 9 10 11 Next »
Advertisements