Home >php教程 >php手册 >计算积分的function

计算积分的function

WBOY
WBOYOriginal
2016-06-21 09:07:171031browse

昨天 GOOCAO搞活动 报名可获得免费上机

把报名的系统完成后需要对积分和上机时间进行计算;写了个function 收藏以后可能用的到

 

/**
     * 积分
     * 表:userbonus
     * */
$ChannelIntegralArr=array(
'threads'=>4,
'comments'=>4
);

function IntagralConsersionTime($Integral,$disinfo=''){
    $AccordTime=30;
    $result=$Integral-$AccordTime;
    if ($result>0){
        $OnlineTime=1;
        for ($i=1;$i            if ($result-$AccordTime                break;
            }
            $result=$result-$AccordTime;
            $OnlineTime++;
        }
        $infos="当前积分:$Integral
可换得上机时间:$OnlineTime 小时
剩余积分:$result";
        if ($disinfo==1){
            echo $infos;
        }else{
            $infos=ereg_replace(' ',' ',$infos);
            echo $infos;
        }
    }else{
        echo "目前积分无法满足条件,不能换算";
    }
}

 



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP 文件的分割Next article:PHP取得电脑网卡地址