php数组应用之比较两个时间的相减排序

前端之家收集整理的这篇文章主要介绍了php数组应用之比较两个时间的相减排序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

$kkk = custom_tuijian("2008-08-15",date("Y-m-d"));
//echo date("Y-m-d");
//print_r($kkk); function custom_tuijian($a,$b)
{
$sql = "select r.,a.articlename,a.author
from <a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>sir_record1 r inner join jieqi_article_article a
on r.bookid = a.articleid where r.rdate = '$a' ";
$res = MysqL_query($sql);
$sql2 = "select r.
,a.author
from <a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>sir_record1 r inner join jieqi_article_article a
on r.bookid = a.articleid where r.rdate = '$b' ";
$res2 = MysqL_query($sql2);
while($row = MysqL_fetch_assoc($res))
{
$row2 = MysqL_fetch_assoc($res2);
$calnum = calnum($row,$row2);
$a_a[$row['bookid']] = $calnum;
$x[$row['bookid']] = array($row["articlename"],$row["author"],$row["bookid"]);
}
arsort($a_a);
foreach($a_a as $k=>$v)
{ $kk[] = array($x[$k][0],$x[$k][1],$x[$k][2],$v);
} return $kk;
}
function calnum($r1,$r2)
{
// 公式 点击/100+推荐2+收藏+鲜花10+月票10
return ($r2['clicknum'] - $r1['clicknum']) / 100 + ($r2['shoucangnum'] - $r1['shoucangnum'])
+ ($r2['xianhuanum'] - $r1['xianhuanum'])
10 + ($r2['yuepiaonum'] - $r1['yuepiaonum']) * 10 ;
}
//数据调用方法
for($ii=0; $ii<100; $ii++){
$bookid=$kkk[$ii][2];
$ml=floor($bookid/1000);
echo "".$kkk[$ii][0]."";
}

原文链接:https://www.f2er.com/php/29522.html

猜你在找的PHP相关文章