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 18 of 81
PHP – bcpowmod() function
In PHP, bcpowmod() function is used to raise an arbitrary precision base number to another exponent number, reduced by a specified modulus. The bcpowmod() function accepts three arbitrary precision numbers as strings and returns the base number raised to the exponent modulo number after scaling the result to the specified precision. Syntax string bcpowmod(string $base, string $exponent, string $modulus, int $scale = 0) Parameters The bcpowmod() function accepts four different parameters − $base, $exponent, $modulus and $scale. $base − It represents the base number. It is a string type parameter. $exponent − ...
Read MorePHP – How to subtract one arbitrary precision number from another using bcsub() function?
In PHP, bcsub() math function is used to subtract one arbitrary precision number from another number. The bcsub() function takes two arbitrary precision numbers as strings and returns the subtraction result after scaling to a specified precision. Syntax string bcsub($num_str1, $num_str2, $scaleVal) Parameters The bcsub() math function accepts three different parameters $num_str1, $num_str2 and $scaleVal. $num_str1 − It represents the left operand and it is the string type parameter. ...
Read MorePHP – How to compare two arbitrary precision numbers using bccomp() function?
In PHP, the bccomp() function is used to compare two arbitrary precision numbers. It takes two numbers as strings and returns an integer indicating which number is larger, smaller, or if they are equal. Syntax int bccomp(string $left_operand, string $right_operand, int $scale = 0) Parameters The bccomp() function accepts three parameters − $left_operand − The left operand as a string representing the first number to compare. $right_operand − The right operand as a string representing the second number to compare. $scale − Optional. The number of decimal places to use in the ...
Read MorePHP – How to divide two arbitrary precision numbers using bcdiv() function?
In PHP, bcdiv() math function is used to divide one arbitrary precision number from another number. The bcdiv() function takes two arbitrary precision numbers as strings and returns the result as a division of two numbers after scaling the result to a specified precision. Syntax string bcdiv($num_string1, $num_string2, $scaleVal) Parameters The bcdiv() function accepts three parameters: $num_string1 − The dividend (string type parameter) $num_string2 − The divisor (string type parameter) $scaleVal − Optional integer parameter that sets the number of digits after the decimal point in the result. Default is 0 ...
Read MorePHP – How to get the modulus of an arbitrary precision number using bcmod() function?
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 MorePHP – How to multiply two arbitrary precision numbers using bcmul() function?
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 MorePHP – How to add two arbitrary precision numbers using bcadd() function?
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 MoreHow to get an affine transformation matrix in PHP using imageaffinematrixget()?
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 MoreHow to check antialias functions be used or not by using imageantialias() function in PHP?
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 MoreHow to apply a 3×3 convolution matrix using imageconvolution() in PHP?
The imageconvolution() function is an inbuilt function in PHP that applies a 3×3 convolution matrix to an image using coefficients and offset values. This function is commonly used for image filtering effects like blur, sharpening, and edge detection. Syntax bool imageconvolution($image, $matrix, $div, $offset) Parameters The imageconvolution() function accepts four parameters: $image − A GD image resource created using image creation functions like imagecreatetruecolor() $matrix − A 3×3 array containing float values representing the convolution kernel $div − The divisor used for normalization ...
Read More