开发者

Argument not passing to particular function!

I have this

function twitter_tweets_per_day($user, $rounding = 1) {
    // Helper function to calculate an average count of tweets per day
    $days_on_twitter = (time() - strtotime($user->created_at)) / 86400;
    return round($user->statuses_count / $days_on_twitter, $rounding);
}

function theme_user_header($user) {
    $following = friendship($u开发者_运维百科ser->screen_name);
    $tweets_per_day = twitter_tweets_per_day($user, 1);
        if (($tweets_per_day) = 1) 
        {$out = Newbie;} 
        return out;
}

The above works flawlessly. But, this, below, doesn't work! Why? Help!

function twitter_mrank_page($user){
    $tweets_per_day = twitter_tweets_per_day($user, 1);
    if($tweets_per_day >= 0 && $tweets_per_day < 200){
        $out =  "'Addict'";
    }
    else{
        $out = "xxx"
    }

    $status = 'My Rank is '.$out.'! '.$tweets_per_day.' ';
    return $status;
}

It returns 0. Why do the first two codes work, whereas the 3rd (which comes beneath the first two in my code) doesn't?


You only return $status if $tweets_per_data >= 4 && $tweets_per_day < 60

Everything else will be 0 ... because you don't return anything

Another good point made ... you are missing a } to close out your function ...

  1. Add debug code
  2. Make sure syntax is correct

Edit

After updates by the Question Author, the only other suggestion I have is to ADD DEBUG CODE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜