<?php function prMonth($start, $end) { $dt_start = strtotime($start); $dt_end = strtotime($end); $return = array(); while ($dt_start <= $dt_end) { $data = date('Y-m',...
// 两个日期之间的所有日期 function prDates($start,$end){ $dt_start = strtotime($start); $dt_end = strtotime($end); $return = []; while ($dt_start<=$dt_end){ $data ...
/** * 把指定时间段切份 - N份 * ----------------------------------- * @param string $start 开始时间 * @param string $end 结束时间 * @param int $nums 切分数目 * @param boolean 是否格式化 * @return array 时间段数组 */ funct...
$a = [ '0' => ['spec_item_id' => 573,'spec_item_thumb' => 'spec_item_thumb',], '1' =>['spec_item_id' => 626,'spec_item_thumb' => 'spec_item_thumb',] ]; $b = [ '0' =...
<?PHP function makeOrderNo() { $yCode = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'); $orderSn = $yCode[intval(date('Y')) - 2017] . strtoupper(dechex(date('m'))) . dat...
<?php function str_replace_1($a,$b,$arr){ $subject = explode($a,$arr); $subject = implode($b,$subject); return $subject ; } $arr = "我们都是111好111孩子"; $res = str_replace_1('111','222',...
<?php function list_sort_by($list, $field, $sortby = 'asc') { if (is_array($list)) { $refer = $resultSet = array(); foreach ($list as $i => $data) { ...
/* * $text是输入的文本; * $word是原来的字符串; * $cword是需要替换成为的字符串; * $pos是指$word在$text中第N次出现的位置,从1开始算起 */ <?php function changeNstr($text,$word,$cword,$pos=1){ $text_array=explode(...
获取随机码,支持纯数字和数字字母组合第一种function randomkeys($length, $type = 'number', $zimu_num = 0) { $pattern = '1234567890abcdefghijklmnopqrstuvwxyz'; $key=''; $temp = $length - $zimu_num; $i = 0;...
# 根据年月日获取星期几的方法 //获取星期方法 function get_week($date){ //强制转换日期格式 $date_str=date('Y-m-d',strtotime($date)); //封装成数组 $arr=explode("-", $date_str); //参数赋值 年 $year=$arr[0...