Home > Backend Development > PHP Tutorial > 工作中用到的PHP函数

工作中用到的PHP函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:16:31
Original
850 people have browsed it

1.根据当前时间计算N天后的时间 $info = (new DateTime($nowDate))->add(new DateInterval("P{$days}D"))->format('Y-m-d’);2.根据一个指定的时间获取改天是周几$weekarray=array("日","一","二","三","四","五","六");echo "星期".$weekarray[date("w","2015-11-26")];3.二维数组排序$data = array(); $data[] = array('volume' => 67, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 1); $data[] = array('volume' => 85, 'edition' => 6); $data[] = array('volume' => 98, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 6); $data[] = array('volume' => 67, 'edition' => 7);  // 取得列的列表 foreach ($data as $key => $row) {     $volume[$key]  = $row['volume'];     $edition[$key] = $row['edition']; }  array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);4.数组去重去空$newData = array_unique(array_filter($oldData));
Copy after login


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template