PHP - gmp_or() 函式



定義和用法

gmp_or() 函式計算給定數字的按位或。

描述

gmp_or() 計算給定的兩個 GMP 數的按位或。

語法

gmp_or ( GMP $a , GMP $b ) : GMP

引數

序號 引數及描述
1

a

它可以是 GMP 資源編號、gmp 物件或數字字串。

2

b

它可以是 GMP 資源編號、gmp 物件或數字字串。

返回值

PHP gmp_or() 函式返回 GMP 數字。

PHP 版本

此函式可在高於 5.0.0 的 PHP 版本中使用。

示例 1

gmp_or() 的工作原理 -

<?php
   $or1 = gmp_or("0xffeffcd", "16");
   $num1 =  gmp_strval($or1, 2);
   echo "The result is :".$num1;
?>

這將產生以下結果 -

The result is :1111111111101111111111011101

示例 2

gmp_or() 的工作原理 -

<?php
   $or1 = gmp_or("0xffeffcd", "16");
   $num1 =  gmp_strval($or1, 8);
   echo "The result is :".$num1;
?>

這將產生以下結果 -

The result is :1777577735
php_function_reference.htm
廣告