Found 1046 Articles for PHP

PHP – How to set or get the default scale parameter for all bc math functions using bcscale() function?

Urmila Samariya
Updated on 21-Aug-2021 07:37:33

209 Views

In PHP, bcscale() function is used to set the default parameter for all bc math functions. This function sets the default scale parameter for all following calls to the bc math functions that do not explicitly specify a scale parameter.Syntaxint bcscale($scale)ParametersThe $bcscale() parameter accepts only a single parameter and it is the mandatory integer type parameter. This parameter shows the number of digits which come after the decimal. Its default value is 0.Return ValueThe $bcscale() function returns the old scale value.Example 1Output113.55960 113.5 113.55957Example 2Output113.55960 113.55 113.559

PHP – bcpowmod() function

Urmila Samariya
Updated on 21-Aug-2021 07:35:50

141 Views

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 it returns the base number raised to the exponent modulo number after scaling the result to the specified precision.SyntaxString bcpowmod($base, $exponent, $modulus, $scale)ParametersThe bcpowmod() function accepts four different parameters− $base, $exponent, $modulus and $scale.$base− It represents the left operand. It is a string type parameter.$exponent− It represents the right operand number which represents the exponent. It is a string type parameter.$modulus− The $modulus parameter accepts the operand ... Read More

PHP – How to subtract one arbitrary precision number from another using bcsub() function?

Urmila Samariya
Updated on 21-Aug-2021 07:34:30

619 Views

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 it gives the subtraction of the two numbers after scaling the result to an identified precision.Syntaxstring bcsub ($num_str1, $num_str2, $scaleVal)ParametersThe 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.$num_str2 − It represents the right operand and it is the string type parameter.$scaleVal − It is the optional integer type parameter that is used to set the number of digits after ... Read More

PHP – How to compare two arbitrary precision numbers using bccomp() function?

Urmila Samariya
Updated on 21-Aug-2021 07:32:02

858 Views

In PHP, bccomp() function is used to compare two arbitrary numbers. The bccomp() function takes two arbitrary precision numbers as strings and gives the output as an integer after comparing the two numbers.Syntaxint bccomp($left_string1, $right_string1, $scaleval)ParametersThe bccomp() function accepts three different parameters− $left_string1, $right_string2 and $scaleval.$left_string1− It represents the left operand of one of two given numbers which we want to do the comparison and it is a string type parameter.$right_string2− It represents the right operand of one of two given numbers which we want to do the comparison and it is a string type parameter.$scaleval− It returns the number ... Read More

PHP – How to divide two arbitrary precision numbers using bcdiv() function?

Urmila Samariya
Updated on 21-Aug-2021 07:29:52

611 Views

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 it gives the result as a division of two numbers after scaling the result to an identified precision. Or, we can say that the bcdiv() PHP function divides the dividend by the divisor.Syntaxstring bcdiv($num_string1, $num_string2, $scaleVal)ParametersThe bcmul() math function accepts three different parameters $num_string1, $num_string2 and $scaleVal.$num_string1 − It represents the dividend and it is the string type parameter.$num_string2 − It represents the divisor, it is the string type parameter.$scaleVal  − It is the optional ... Read More

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

Urmila Samariya
Updated on 21-Aug-2021 07:27:15

197 Views

In PHP, bcmod() math function is used to calculate the modulus of an arbitrary precision number. The bcmod() function takes an arbitrary precision number as strings and it gives the result as a modulus of numbers after scaling the result to an identified precision. Or, we can say that it gets the remainder after dividing string_num1 by string_num2. Unless the string_num2 is 0, the result has the same sign as string_num1.Syntaxbcmod(string_$num1, string_$num2, [, int $scale=0])Or, bcmod(string $dividend, string $divisor[, int $scale=0])Note− The above syntax will get the remainder of dividing $string_num1 by $string_num2. Unless string_num2 is 0, the result has ... Read More

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

Urmila Samariya
Updated on 21-Aug-2021 07:24:52

1K+ Views

In PHP, bcmul() math function is used to multiply one arbitrary precision number with another number. The bcmul() function takes two arbitrary precision numbers as strings and it gives the result as the multiplication of two numbers after scaling the result to an identified precision.Syntaxstring bcmul( $num_string1, $num_string2, $scaleVal)ParametersThe bcmul() math function accepts three different parameters $num_string1, $num_string2 and $scaleVal.$num_string1 - It represents the left operand and it is the string type parameter.$num_string2 - It represents the right operand, it is the string type parameter.$scaleVal - This is the optional integer type parameter that is used to set the number of digits ... Read More

PHP – How to raise an arbitrary precision number to another using bcpow() function?

Urmila Samariya
Updated on 21-Aug-2021 07:21:51

118 Views

In PHP, bcpow() function is used to raise an arbitrary precision base number to another exponent number. It takes two arbitrary precision numbers as strings and gives the base number raised to the power exponent after scaling the result to the listed precision.SyntaxString bcpow($base, $exponent, $scale)ParametersThe bcpow() function in PHP takes three different parameters: $base, $exponent and $scale.$base - It represents the base in which power will be raised and it is the string type parameter.$exponent - It represents the exponent and it is the string type parameter.$scale - It indicates the number of digits that appear after the decimal in ... Read More

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

Urmila Samariya
Updated on 21-Aug-2021 07:20:13

332 Views

In PHP, bcadd() math function is used to add two arbitrary precision numbers. The bcadd() function takes two random precision numbers as strings and it returns the addition of the two numbers after scaling the result to an identified precision.Syntaxstring bcadd ( $num_str1, $num_str2, $scaleVal)ParametersThe bcadd() 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.$num_str2 - It represents the right operand and it is the string type parameter.$scaleVal - It is the optional parameter that is used to set the number of digits after the decimal place in the ... Read More

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

Urmila Samariya
Updated on 09-Aug-2021 13:59:29

149 Views

imageaffinematrixget() is an inbuilt function in PHP that is used to get an affine transformation matrix. This function is often used in linear algebra and computer graphics.Syntaxarray imageaffinematrixget(int $type, mixed $options)Parametersimageaffinematrixget() accepts only two parameters: $type and $options.$type − The $type parameter specifies the integer to IMG_AFFINE constants.IMG_AFFINE_TRANSLATEIMG_AFFINE_SCALEIMG_AFFINE_ROTATEIMG_AFFINE_SHEAR_HORIZONTALIMG_AFFINE_SHEAR_VERTICAL$options − If type is IMG_AFFINE_TRANSLATE or IMG_AFFINE_SCALE, options has to be an array with keys x and y, both having float values. If type is IMG_AFFINE_ROTATE, IMG_AFFINE_SHEAR_HORIZONTAL or IMG_AFFINE_SHEAR_VERTICAL, options has to be a float specifying the angle.Return ValuesIt returns an affine transformation matrix, an array with keys from 0 to 5 ... Read More

Advertisements