Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Samual Sam
Page 57 of 151
hypot() function in PHP
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 Morefmod() function in PHP
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 Moreexpm1() function in PHP
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 Moredeg2rad() function in PHP
The deg2rad() function converts degree values to their radian equivalents. Radians are the standard unit of angular measurement used in many mathematical calculations, while degrees are more commonly used in everyday applications. Syntax deg2rad(number) Parameters number − The degree value to be converted to radians. Accepts integer or float values. Return Value Returns a float representing the radian equivalent of the specified degree value. Example 1: Basic Conversion Here's how to convert a single degree value to radians − 360 degrees converted ...
Read Moredechex() function in PHP
The dechex() function converts decimal numbers to their hexadecimal representation. It returns the hexadecimal string equivalent of the specified decimal value. Syntax dechex(number) Parameters number − The decimal value to be converted. Can be an integer or numeric string. Return Value Returns a string containing the hexadecimal representation of the given decimal number. Example Here's how to convert decimal numbers to hexadecimal format − f 7c6 ff 0 Working with Different Number Types The function accepts both integers and numeric strings −
Read Morecosh() function in PHP
The cosh() function in PHP returns the hyperbolic cosine of a number. This mathematical function is useful for calculations involving exponential growth and decay, catenary curves, and engineering applications. Syntax cosh(number) Parameters number − A numeric value for which to calculate the hyperbolic cosine. The value should be in radians. Return Value Returns a floating-point number representing the hyperbolic cosine of the input value. The result is always positive since cosh(x) = cosh(-x). Examples Basic Usage Here's how to calculate the hyperbolic cosine of positive and negative ...
Read Moreceil() function in PHP
The ceil() function rounds a number up to the nearest greater integer. This function always rounds up, regardless of the decimal value. Syntax ceil(number) Parameters number − The numeric value to round up Return Value Returns the value rounded up to the nearest integer as a float. Example 1: Basic Usage Here's how ceil() works with positive decimal numbers ? 1 1 3 Example 2: Whole Numbers When applied to whole numbers, ceil() returns the same value ? ...
Read Morebase_convert() function in PHP
The base_convert() function converts a number from one base to another, for example, octal number to decimal number. The base mentioned here should be between 2 and 36. Digits in numbers with a base greater than 10 are represented with the letters a-z, where a is 10, b is 11, c is 12, d is 13, and so on up to z which is 35. Syntax base_convert(num, original_base, to_base) Parameters num − The number to convert (as a string) original_base − The original base of the number (between 2 and 36) to_base − ...
Read Moreatan2() function in PHP
The atan2() function in PHP returns the arc tangent of two variables. It calculates the angle in radians between the positive x-axis and the ray from the origin to the point (val2, val1). Syntax atan2(y, x) Parameters y − The y-coordinate (dividend) x − The x-coordinate (divisor) Return Value The atan2() function returns the arc tangent of y/x in radians. The returned value is between -π and π, which represents the angle from the positive x-axis to the point (x, y). Example 1 Basic usage with positive values ...
Read MoreGet attribute list from MongoDB object?
To get attribute list from MongoDB object, use a for...in loop to iterate through the document properties and extract each key and value along with their data types. Syntax var document = db.collection.findOne(); for (key in document) { var value = document[key]; print(key + "(" + typeof(value) + "): " + value); } Create Sample Data db.getAttributeListDemo.insertOne({ "StudentId": 101, "StudentName": "John", "StudentAdmissionDate": new ISODate('2019-01-12'), "StudentSubjects": ["MongoDB", "Java", "MySQL"] }); ...
Read More