• PHP Video Tutorials

PHP - gmp_mul() Function



Definition and Usage

The gmp_mul() function multiplies the GMP numbers.

Description

The gmp_mul() function will multiply given two gmp numbers and return the result.

Syntax

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

Parameters

Sr.No Parameter & Description
1

a

It can a GMP resource number , a gmp object or a numeric string.

2

b

It can a GMP resource number , a gmp object or a numeric string. The value of b has to be positive and odd.

Return Values

PHP gmp_mul() function multiplies the given numbers and returns a GMP number.

PHP Version

This function will work from PHP Version greater than 5.0.0.

Example 1

Working of gmp_mul −

<?php
   $num = gmp_mul("30", "11");
   echo "The result is :".$num;
?>

This will produce following result −

The result is :330

Example 2

Working of gmp_mul −

<?php
   $num = gmp_mul("0xFE", "0x80");
   echo "The result is :".$num;
?>

This will produce following result −

The result is :32512
php_function_reference.htm
Advertisements