private static function get_field($id,$str='|'){ if(is_array($id)){ $sql="";$i=0; foreach($id as $val){ $i++; if($i<coun...
$result = array_reduce($filename, function ($result, $value) { return array_merge($result, array_values($value)); }, array());
<?php $arr=Array( Array('id' => 1,'type' => '空调'), Array('id' => 2,'type' => '电视机'), Array('id' => 3,'type' => '空调') ); function filter($elem){ return $elem['ty...
<?php function posttime($isToday=true){ $startTime = floor(date( 'H ',strtotime('03:35'))); $endTime = floor(date( 'H',strtotime('22:35'))); $nowtime = strtotime(date("H:...
$list = [ ['id' => 1, 'status' => 1], ['id' => 2, 'status' => 2], ['id' => 3, 'status' => 5], ]; $actions = [ 1 => function () { return '未提交'; }, ...
<?php $week_list = []; $week_arr = ["日","一","二","三","四","五","六"]; $time = time(); for($i = 0 ; $i<7 ; $i++){ $w...
<?php $number = 'A89'; for ($x=0; $x<=10; $x++) { $num = ++$number; echo "<hr/>"; echo $num; } A90 A91 A92 A93 A94 A95 A96 A97 A98 A99 B00
$arr1 = array('hour0'=>3,'hour1'=>6,'hour2'=>7); $arr2 = array('hour0'=>34,'hour1'=>213,'hour2'=>56); $result = array(); if (count($arr1) == count($arr2)) { for($i = 0; $i <...
<?php $arr = [ '0'=>['id'=>1,'name'=>'jack','size'=>15], '1'=>['id'=>2,'name'=>'viket','size'=>15] ]; echo array_sum(array_map(function($val){return $val['size'];...
if(preg_match("/(Googlebot|Msnbot|YodaoBot|Sosospider|Baiduspider|Sogou web spider|gosospider|Huaweisymantecspider|Gigabot|OutfoxBot)/i", $_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_US...