当我将latitude
和longitude
传递给负值时,我收到此错误。当我通过正值时,它正常工作。需要一个解决方案。
错误:
1.Warning: array_intersect(): Argument #2 is not an array in C:\wamp\www\#\#.php on line 41
2.Warning: array_keys() expects parameter 1 to be array, null given in C:\wamp\www\#\#.php on line 42
$aaa=0;
$e=0;
$s=0;
$query1=mysql_query("select * from user_details where username!='$a' and availablestatus='1' and status='1'");
while($row=mysql_fetch_array($query1))
{
$q[$e++]=$row['id'];
$m=$row['username'];
$k=$row['latitude'];
$l=$row['longitude'];
$aa[$aaa++]=1609.344 * 60 * 1.1515 * (180 / pi()) * acos(sin($i * pi() / 180) * sin($k * pi() / 180) + cos($i * pi() / 180) * cos($k * pi() / 180) * cos(($j - $l) * pi() / 180));
}
$res=array_combine($q,$aa);
foreach($res as $val)
{
if($val>='0' && $val<='10000')
{
$ah[$s++]=$val;
}
}
$rs=array_intersect($res,$ah);
$rs1=array_keys($rs);
答案 0 :(得分:0)
问题是if($val>='0' && $val<='10000')
只允许正值。
如果这是预期行为,请在$ah=array();
foreach($res as $val)