HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_perfect_square

Description

The gmp_perfect_square of GMP for PHP perfect square check.

Syntax

gmp_perfect_square(
    GMP|int|string $num
): bool

Parameters

num

The number being checked as a perfect square.

A GMP object, an int or a numeric string.

Return

Returns true if num is a perfect square, false otherwise.

Examples

1 · num · GMP

<?

$num = 4;

$num = gmp_init($num);

$return = gmp_perfect_square($num);

var_export($return);
true

2 · num · int

<?

$num = 4;

$return = gmp_perfect_square($num);

var_export($return);
true

3 · num · string

<?

$num = "4";

$return = gmp_perfect_square($num);

var_export($return);
true