<?php
GMP gmp_sqrt ( GMP|int|string $num )
where,
$num = GMP number to obtain the INTEGER portion of square root
?>
<?php
function intptsqrt01 ( $a01 )
{
$sqr01 = gmp_sqrt($a01);
echo $sqr01 . ' is the integer portion of square root of ' .
$a01 . '<br><br>';
}
$a01a = [ '0200000', '0200001', '0x10000', '0x1000A',
65536, 65537, 200, '023', '0x13',
0, 3, 19 ];
foreach($a01a as $a01)
{
intptsqrt01($a01);
}
?>
<?php
function intptsqrt02 ( $a02 )
{
$sqr02 = gmp_sqrt($a02);
echo $sqr02 . ' is the integer portion of square root of ' .
$a02 . '<br><br>';
}
$a02a = [ -256, -2, -1 ];
foreach($a02a as $a02)
{
intptsqrt02($a02);
}
?>