What is gmp_mul in PHP?

gmp_mul is a function in PHP which multiplies two numbers.

Syntax

gmp_mul(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 GMPGNU Multiple Precision Arithmetic Library object, integer, or numeric string.

Return value

The function returns the product of num1 and num2, which is a number of GMP type.

Code

<?php
$val1 = gmp_mul("12345678", "20");
echo gmp_strval($val1) . "\n";
?>

Expected output

246913560