karthikeya Boyini

karthikeya Boyini

1,420 Articles Published

Articles by karthikeya Boyini

Page 58 of 142

is_finite() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 136 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

floor() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 223 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

exp() function in PHP

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 152 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

decbin() function in PHP

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

The decbin() function converts a decimal number to its binary representation and returns the result as a string. Syntax decbin(num) Parameters num − The decimal number to be converted to binary. Can be an integer or string representation of a number. Return Value Returns a string containing the binary representation of the given decimal number. Example 1 Converting a decimal number to binary ? 111100011001 Example 2 Converting another decimal number to binary ? ...

Read More

bindec() function in PHP

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

The bindec() function converts a binary number to its decimal equivalent. It takes a binary string as input and returns the corresponding decimal value. Syntax bindec(binary_string) Parameters binary_string − The binary string to convert. Must contain only 0s and 1s. Return Value The bindec() function returns the decimal value of the specified binary string. If the input contains invalid characters, it stops processing at the first invalid character. Examples Basic Conversion Here's a simple example converting binary to decimal ? 13 ...

Read More

PHP timestamp to HTML5 input type=datetime element

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 1K+ Views

HTML5 datetime input elements require a specific format: YYYY-MM-DDTHH:MM:SS. In PHP, you can convert timestamps to this format using the date() function with the appropriate format string. Basic DateTime Format To format the current timestamp for HTML5 datetime input − 2024-03-28T19:12:49 Converting Specific Timestamp To convert a specific Unix timestamp to HTML5 datetime format − 2022-01-01T00:00:00 HTML Integration Using the formatted timestamp in an HTML datetime input element −

Read More

Check for Existing Document in MongoDB?

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

In MongoDB, you can check if a document exists in a collection using the findOne() method. This method returns the first document that matches the query criteria, or null if no document is found. Syntax db.collectionName.findOne({fieldName: "value"}); Sample Data Let us create a collection with sample documents − db.checkExistingDemo.insertMany([ {"StudentName": "John"}, {"StudentName": "Carol"}, {"StudentName": "Sam"}, {"StudentName": "Mike"} ]); { "acknowledged": true, "insertedIds": [ ...

Read More

Convert NumberLong to String in MongoDB?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 2K+ Views

In MongoDB, you can convert NumberLong values to strings using two approaches: the toString() method for explicit string conversion, or valueOf() method for numeric value extraction. Syntax // Method 1: Convert to String NumberLong('value').valueOf().toString() // Method 2: Convert to Number NumberLong('value').valueOf() Method 1: Using toString() for String Conversion The toString() method explicitly converts the NumberLong to a string representation ? NumberLong('1000').valueOf().toString(); 1000 Method 2: Using valueOf() for Number Conversion The valueOf() method returns the numeric value of NumberLong ? NumberLong('1000').valueOf(); ...

Read More

MongoDB shutdown option is unavailable? How to get it?

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

If the MongoDB shutdown option is unavailable, you need to switch to the admin database first. The shutdownServer() method requires administrative privileges and can only be executed from the admin database context. Syntax use admin db.shutdownServer() Step 1: Switch to Admin Database First, connect to the admin database ? use admin switched to db admin Step 2: Execute Shutdown Command Now run the shutdown command ? db.shutdownServer() server should be down... 2019-04-22T19:11:40.949+0530 I NETWORK [js] trying reconnect to 127.0.0.1:27017 failed 2019-04-22T19:11:42.197+0530 ...

Read More

How can I use a script to create users in MongoDB?

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

You can create users in MongoDB using the createUser() method. This method allows you to define username, password, and specific roles for database access control. Syntax db.createUser( { user: "yourUserName", pwd: "yourPassword", roles: [ { role: "roleType", db: "databaseName" } ] } ); Example Let us create a user named "David" with read access to the "test" database ? db.createUser( ...

Read More
Showing 571–580 of 1,420 articles
« Prev 1 56 57 58 59 60 142 Next »
Advertisements