gmp_perfect_square() function in PHP


The gmp_perfect_square() function checks if the GMP number is a perfect square or not.

Syntax

gmp_perfect_square(val)

Parameters

  • val − The GMP number to be checked. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

Return

The gmp_perfect_square() function returns TRUE if val is a perfect square.

Example

The following is an example −

<?php
   $val = "36";
   var_dump(gmp_perfect_square($val))."n";
?>

Output

The following is the output −

bool(true)

Updated on: 30-Jun-2020

36 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements