<?php
//如果不是完全平方数,返回0,是的话,返回其平方根
function isPerfectSquare($num)
{
$num1 = 1;
$i=0;
while($num > 0)
{
$num -= $num1;
$num1 += 2;
$i++;
}
return $num==0?$i:0;
}
echo isPerfectSquare(19600);