我有以下情形变量范围在PHP
在查找功能我已经达到变量,我希望得到一些在$覆盖所有变量$跟随值。
下面的代码给出了follwer的最后一个值,而不是所有的总和。错误在哪里?
function x()
{
lookup($tweetid,$connection);
}
function lookup($tweetid,$connection)
{
$tweets5 = $connection->get("https://api.twitter.com/1.1/statuses/retweets/".$tweetid.".json?count=1");
$json = json_encode($tweets5);
foreach($tweets5 as $item)
{
$text = $item->text;
$user_id = $item->user->id;
$name = $item->user->name;
$follower = $item->user->followers_count;
$reach + = $follower; //This does not work
// $reach = $raech + $follower; //This does not work
$friend = $item->user->friends_count;
echo "Text : $text <br> ID : $user_id <br> Name : $name <br> Follower : $follower <br> Friends : $friend <br> ---";
}
echo "<br> RT reach : $reach"; //This does not give some of folloewer count
}
什么你得到$ follower变量 – Sadikhasan