Server Side Programming Articles

Page 1006 of 2109

PHP – How to get the modulus of an arbitrary precision number using bcmod() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 378 Views

In PHP, bcmod() math function is used to calculate the modulus of an arbitrary precision number. The bcmod() function takes arbitrary precision numbers as strings and returns the remainder after dividing the dividend by the divisor. Unless the divisor is 0, the result has the same sign as the dividend. Syntax bcmod(string $dividend, string $divisor[, int $scale = 0]) Note − The scale parameter was added from PHP 7.2.0 version. Parameters The bcmod() function accepts the following parameters ? $dividend − The dividend that is divided by ...

Read More

How to print % using printf()?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 5K+ Views

In C, the printf() function uses the percent symbol (%) as a format specifier. To print the actual % character as text, you need to use a double percent (%%) because a single % has special meaning in printf() and will not display anything. Syntax printf("%%"); // Prints a single % character Example 1: Basic % Printing Here's how to print the % symbol using printf() − #include int main() { printf("Single percent: %%"); printf("Percentage: 85%%"); printf("Multiple: ...

Read More

PHP – How to multiply two arbitrary precision numbers using bcmul() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 2K+ Views

In PHP, bcmul() function is used to multiply two arbitrary precision numbers. This function is particularly useful when dealing with very large numbers or when you need precise decimal calculations that exceed PHP's floating-point precision limits. Syntax string bcmul(string $num1, string $num2, ?int $scale = null) Parameters The bcmul() function accepts three parameters − $num1 − The left operand as a string representing an arbitrary precision number. $num2 − The right operand as a string representing an arbitrary precision number. $scale − Optional integer parameter that sets the number of decimal places ...

Read More

"register" keyword in C

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

In C programming, the register keyword is a storage class specifier that suggests to the compiler to store a variable in CPU registers instead of main memory. Register variables provide faster access since CPU registers are much faster than memory. However, taking the address of a register variable is not allowed. Syntax register data_type variable_name; Properties of Register Variables Scope: Local to the function in which they are declared Default value: Garbage value (uninitialized) Lifetime: Until the end of the block execution Storage: CPU registers (compiler's choice) Address: Cannot use address-of operator (&) ...

Read More

PHP – How to add two arbitrary precision numbers using bcadd() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 518 Views

In PHP, bcadd() math function is used to add two arbitrary precision numbers. The bcadd() function takes two arbitrary precision numbers as strings and returns their sum, scaling the result to a specified precision. Syntax string bcadd(string $num1, string $num2, int $scale = 0) Parameters The bcadd() function accepts three parameters − $num1 − The left operand as a string representing an arbitrary precision number. $num2 − The right operand as a string representing an arbitrary precision number. $scale − ...

Read More

"extern" keyword in C

Samual Sam
Samual Sam
Updated on 15-Mar-2026 21K+ Views

The extern keyword in C is used to declare variables and functions that are defined elsewhere, either in the same file or in other source files. It extends the visibility of variables and functions across multiple files, making them globally accessible. Syntax extern data_type variable_name; extern data_type function_name(parameters); Key Properties Scope − Global throughout the program, not bound by any function. Default value − Global variables are initialized to zero by default. Lifetime − Exists until the end of program execution. Important Points External variables can be declared multiple times but ...

Read More

How to get an affine transformation matrix in PHP using imageaffinematrixget()?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 245 Views

The imageaffinematrixget() function is an inbuilt PHP function that generates an affine transformation matrix. This function is commonly used in computer graphics and image processing to define transformations like scaling, rotation, translation, and shearing ? Note: This function requires the GD extension to be installed in PHP. Syntax array imageaffinematrixget(int $type, mixed $options) Parameters The function accepts two parameters ? $type − An integer constant that specifies the transformation type: IMG_AFFINE_TRANSLATE − Translation (movement) IMG_AFFINE_SCALE − Scaling (resize) IMG_AFFINE_ROTATE − Rotation IMG_AFFINE_SHEAR_HORIZONTAL − Horizontal shearing IMG_AFFINE_SHEAR_VERTICAL − Vertical ...

Read More

How to convert a string to a integer in C

Pythonista
Pythonista
Updated on 15-Mar-2026 738 Views

In C programming, converting a string to an integer is a common task that can be accomplished using several built-in functions. The most commonly used functions are atoi(), strtol(), and sscanf(). Syntax int atoi(const char *str); long strtol(const char *str, char **endptr, int base); int sscanf(const char *str, const char *format, ...); Method 1: Using atoi() Function The atoi() function converts a string to an integer. It stops reading when it encounters a non-digit character − #include #include int main() { char str[] = "12345"; ...

Read More

How to check antialias functions be used or not by using imageantialias() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 200 Views

The imageantialias() function is an inbuilt PHP function that enables or disables antialiasing for drawing operations. It activates fast drawing anti-aliased methods for lines and wired polygons, working only with true-color images without alpha component support. Syntax bool imageantialias($image, $enabled) Parameters The imageantialias() function takes two parameters: $image − A GdImage object or image resource created by image creation functions like imagecreatetruecolor(). $enabled − A boolean value that enables (true) or disables (false) antialiasing. Return Value Returns true on success or false on failure. Example Here's how ...

Read More

List of Common Reasons for Segmentation Faults in C/C++

Ramu Prasad
Ramu Prasad
Updated on 15-Mar-2026 5K+ Views

The main reason for segmentation fault is accessing memory that is either not initialized, out of bounds for your program or trying to modify string literals. These may cause a segmentation fault though it is not guaranteed that they will cause a segmentation fault. Here are some of the common reasons for segmentation faults − Accessing an array out of bounds Dereferencing NULL pointers Dereferencing freed memory Dereferencing uninitialized pointers Incorrect use of the "&" (address of) and "*" (dereferencing) operators Improper formatting specifiers in printf and scanf statements Stack overflow Writing to read-only memory Common ...

Read More
Showing 10051–10060 of 21,090 articles
Advertisements