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
PHP Articles
Page 78 of 81
cosh() 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 Morebindec() function in PHP
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 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 MorePHP timestamp to HTML5 input type=datetime element
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 MoreHow can we write PHP script to get the list of MySQL database?
We can write PHP scripts to get the list of available MySQL databases using different approaches. Since the legacy MySQL extension is deprecated, we'll show modern methods using MySQLi and PDO. Using MySQLi Extension The MySQLi extension provides a simple way to list databases − Using PDO Extension PDO provides a more secure and flexible approach − Comparison Method Security Status Legacy MySQL Low Deprecated MySQLi High Active PDO High Active (Recommended) Conclusion Use ...
Read MoreHow can we create a MySQL temporary table by using PHP script?
In PHP, you can create a MySQL temporary table using database connection functions like mysqli or PDO. Temporary tables are automatically dropped when the connection ends, making them useful for storing intermediate results during complex operations. Using MySQLi Extension The modern approach uses the mysqli extension to connect and execute the CREATE TEMPORARY TABLE statement − Using PDO Extension Alternatively, you can use PDO for better error handling and database portability − Key Points Feature Temporary Table Regular Table Visibility Session only ...
Read MoreHow to write PHP script by using MySQL JOINS inside it to join two MySQL tables?
MySQL JOINs allow you to combine data from multiple tables based on related columns. In PHP, you can execute JOIN queries using database connection functions and process the results to display combined information from different tables. Sample Database Tables Let's work with two sample tables to demonstrate the JOIN operation ? mysql> SELECT * FROM tcount_tbl; +-----------------+----------------+ | tutorial_author | tutorial_count | +-----------------+----------------+ | mahran | 20 | | mahnaz ...
Read MoreHow to write PHP script to update an existing MySQL table?
In PHP, you can update existing records in a MySQL table using the SQL UPDATE statement. Modern PHP uses MySQLi or PDO extensions to interact with databases securely and efficiently. Using MySQLi (Procedural) The procedural MySQLi approach provides a straightforward way to update database records −
Read More