What is gmp_or in PHP?

gmp_or is a function in PHP that returns the bitwise OR two numbers.

Syntax

gmp_or(GMP|int|string $num1, GMP|int|string $num2): GMP

Parameters

The function takes in two parameters, num1 and num2.

num1 and num2 can be a numeric string, GMPGNU Multiple Precision Arithmetic Library object, or the int type.

Return value

The function returns the bitwise OR num1 and num2. The value returned is type GMP number.

Code

<?php
$val1 = "10";
$val2 = "9";
echo gmp_or($num1, $num2);
?>

Expected output

11
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources