array_filter — 用回调函数过滤数组中的单元
[codesyntax lang="php"]
$input = [
[
'id' => 1,
'name' => '11'
],
[
'id' => 2,
'name' => '22'
],
[...
[codesyntax lang="php"]
$a1=array("Pluto","Fido","Missy");
array_multisort($a1,SORT_ASC);
print_r($a1);
[/codesyntax]
打印结果:
[codesyntax lang="php"]
Array
(
[0] => Fido
[1] =>...
[codesyntax lang="php"]
//产生一个10000的一个数组。
$max = 10000;
$test_arr = range(0, $max);
$temp = 0;
//我们分别用三种方法测试求这些数加上1的值的时间。
// for 的方法
$t1 = microtime(true);
for ($i = 0; $i...
[codesyntax lang="php"]
header('content-type:text/html;charset=utf-8');
//生命一个计算脚本运行时间的类
class Timer
{
private $startTime = 0; //保存脚本开始执行时的时间(以微秒的形式保存)
private $stop...
array_udiff — 用回调函数比较数据来计算数组的差集
[codesyntax lang="php"]
array array_udiff ( array $array1 , array $array2 [, array $... ], callable $value_compare_func )
[/codesyntax]
使用回调函数比较数据,计算数...
[codesyntax lang="php"]
<?php
class Time
{
/**
* 返回今日开始和结束的时间戳
*
* @return array
*/
public static function today()
{
return [
mktime(0, 0...
将请求存入redis为了模拟多个用户的请求,使用一个for循环替代
[codesyntax lang="php"]
//redis数据入队操作
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
for($i=0;$i<50;$i++){
try{
...