php 内爆数组帮助
我正在尝试将 $users_in_range 数组中的 userID 内爆,问题是它是内爆英里而不是 userid
<?PHP
$users_in_range = users_in_range($lat, $long, 500, true);
// implode users into mysql friendly list
$comma_separated = implode(",", $users_in_range);
echo $comma_separated;
// this is just for output while debugging
foreach ($users_in_range as $userid => $miles_away) {
echo "UserID=<b>$userid</b> is <b>$miles_away</b> miles away from me.<br />";
}
?>
I am trying to the implode the userIDs in the $users_in_range array the problem is it is iploding miles instead of userid
<?PHP
$users_in_range = users_in_range($lat, $long, 500, true);
// implode users into mysql friendly list
$comma_separated = implode(",", $users_in_range);
echo $comma_separated;
// this is just for output while debugging
foreach ($users_in_range as $userid => $miles_away) {
echo "UserID=<b>$userid</b> is <b>$miles_away</b> miles away from me.<br />";
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
userid 是数组的键,因此您需要执行以下操作:
The userid is the key of the array, so you need to do:
尝试 :
try :