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
Server Side Programming Articles
Page 1065 of 2109
deg2rad() 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 Moredecbin() function in PHP
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 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 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 MoreHow to pass JavaScript variables to PHP?
You can pass JavaScript variables to PHP using several methods. Since PHP runs on the server and JavaScript runs in the browser, direct variable passing isn't possible. However, you can achieve this through AJAX requests, form submissions, or by embedding JavaScript values in PHP output. Method 1: Using AJAX POST Request The most common approach is to send JavaScript variables to PHP using AJAX − Pass JS to PHP Send Data to PHP ...
Read MoreHow to call Python file from within PHP?
In PHP, you can execute Python scripts using built-in functions like shell_exec(), exec(), or proc_open(). Each method offers different levels of control over the process. Using shell_exec() The simplest approach − runs a command via the shell and returns the output as a string. Use escapeshellcmd() to sanitize the command ? The square of 4 is 16 Specifying the Python Interpreter If the script lacks a shebang line (#!/usr/bin/env python3), explicitly call the interpreter ? The square of 5 is 25 ...
Read More