PHP | gmp_or() Function Last Updated : 14 Apr, 2018 Comments Improve Suggest changes Like Article Like Report The gmp_or() is an inbuilt function in PHP which is used to calculate the bitwise OR of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_or($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. These parameters can be GMP objects in PHP version 5.6 and later, or we are also allowed to pass numeric strings such that it is possible to convert those strings to numbers. Return Value: This function returns a GMP number which is the bitwise OR of the GMP numbers passed to it as parameters. Examples: Input : gmp_or("4", "2") Output : 6 Input : gmp_or("9", "10") Output : 11 Below programs illustrate the gmp_or() function in PHP: Program 1: Program to calculate the bitwise OR of GMP numbers when numeric strings as GMP numbers are passed as arguments. php <?php // PHP program to calculate the bitwise OR // GMP numbers passed as arguments // strings as GMP numbers $num1 = "10"; $num2 = "9"; // calculate the bitwise OR of $num1 and $num2 $res = gmp_or($num1, $num2); echo $res; ?> Output: 11 Program 2: Program to calculate the bitwise OR of GMP numbers when GMP numbers are passed as arguments. php <?php // PHP program to calculate the bitwise OR // GMP numbers passed as arguments // creating GMP numbers using gmp_init() $num1 = gmp_init(4); $num2 = gmp_init(2); // calculate the bitwise OR of $num1 and $num2 $res = gmp_or($num1, $num2); echo $res; ?> Output: 6 Reference: http://php.net/manual/en/function.gmp-or.php Comment More infoAdvertise with us Next Article PHP | gmp_or() Function A akash1295 Follow Improve Article Tags : Web Technologies PHP PHP-gmp Similar Reads PHP | gmp_import() Function The gmp_import() function is an inbuilt function in php which imports a GMP number(GNU Multiple Precision: For large numbers) from a binary string. Syntax: GMP gmp_import ( string $data, int $word_size, int $options ) Parameters: The gmp_import() function accepts three parameters as mentioned above 2 min read PHP mb_ord() Function The m_ord() is an inbuilt function in PHP that returns the Unicode code point for the specific character. Syntax: mb_ord(string $string, ?string $encoding = null): int|falseParameters: This function has two parameters: string: This is the string input. It must be a valid string.encoding: The encodin 1 min read PHP | gmp_neg() Function The gmp_neg() function is an in-built function in PHP which returns the negative of a GMP number (GNU Multiple Precision). Syntax : gmp_neg( $num ) Parameters : The function accepts only one mandatory parameter $num which can be either a GMP number resource in PHP 5.5 or a GMP object in PHP version 1 min read PHP | gmp_mul() Function The gmp_mul() function in PHP is an inbuilt function which is used to multiply two GMP numbers (GNU Multiple Precision: For large numbers). Syntax: GMP gmp_mul ( GMP $num1, GMP $num2 ) Parameters: This function accepts two GMP numbers. It is mandatory parameters as shown in the above syntax. These c 1 min read PHP gmp_lcm() Function The gmp_lcm() is an inbuilt function in PHP that is used to calculate the least common multiple (LCM) of two or more integers. Syntax: gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMPParameters: This function accepts two parameters that are described below. $num1: A GMP number resource repre 1 min read PHP | gmp_jacobi() Function The gmp_jacobi() function is an in-built function in PHP which computes the Jacobi symbol of two GMP numbers (GNU Multiple Precision : For large numbers) $num1 and $num2 passed as parameters to the function and returns it. $num2 must be positive and odd. Syntax : gmp_jacobi($num1, $num2) Parameters 2 min read PHP gmp_init() Function The gmp_init() function is an inbuilt function in PHP that is used to create a GMP number from different data types, including strings, integers, or other GMP objects. It's commonly used when you want to start performing arithmetic operations on large numbers without losing precision. Syntax: gmp_in 2 min read PHP | gmp_and() Function The gmp_and() is an inbuilt function in PHP which is used to calculate the bitwise AND of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_and($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. T 2 min read PHP | gmp_cmp() Function The gmp_cmp() is an inbuilt function in PHP which is used to compare two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_cmp($num1, $num2) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters as shown in the above syntax for comparing. These 2 min read PHP | gmp_xor() Function The gmp_xor() is an in-built function in PHP which is used to calculate the XOR of 2 GMP numbers (GNU Multiple Precision : For large numbers). Syntax: gmp_xor( $num1, $num2 ) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters shown in the above syntax. These pa 2 min read Like