<?php
bool gmp_perfect_square ( GMP|int|string $num )
where,
$num = The number to be checked if is a perfect square
?>
<?php
// Look Warning in PHP 7
echo PHP_VERSION . '<br><br>';
function checkifpsqr01 ( $a01 )
{
if (gmp_perfect_square($a01) == TRUE)
{
echo $a01 . ' is a perfect square!<br><br>';
}
else
{
echo $a01 . ' is NOT a perfect square!<br><br>';
}
}
$a01a = [ '020', '021', '0x90', '0x9A', 65536, 65537 ,
0, 1, 3, 4, 7, 9, 9.55 ];
foreach($a01a as $a01)
{
checkifpsqr01($a01);
}
?>
<?php
// Look Warning in PHP 7
echo PHP_VERSION . '<br><br>';
function checkifpsqr02 ( $a02 )
{
if (gmp_perfect_square($a02) == TRUE)
{
echo $a02 . ' is a perfect square!<br><br>';
}
else
{
echo $a02 . ' is NOT a perfect square!<br><br>';
}
}
$a02a = [ -1.212, -3, -4, -7, -9, -99.55 ];
foreach($a02a as $a02)
{
checkifpsqr02($a02);
}
?>