php 二维数组排序
$a=array( array("key1"=>940,"key2"=>"blash"), array("key1"=>23,"key2"=>"this"), array("key1"=>894,"key2"=>"that") ); function asc_number($x,$y){ if($x["key1"]>$y["key1"]){ return true; }elseif($x["key1"]<$y["key1"]){ return false; }else{ return 0; } } //strcasecmp 不区分大小写 //strcmp 区分大小写 function string_sort($x,$y){ return strcasecmp($x["key2"], $y["key2"]); } //数组过滤 $var=300; $int_options = array("options"=> array("min_range"=>0, "max_range"=>256)); var_dump(filter_var($var, FILTER_VALIDATE_INT, $int_options));