Blogger Information
Blog 6
fans 0
comment 0
visits 1878
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
数组笔记2
mtf
Original
719 people have browsed it

count($arr,1)第二个参数默认为零,写1则检测多维数组

array_unique($arr)删除重复的值

array_count_values($arr)返回一个关联数组,键为¥arr的值,值为出现的次数,¥arr的值必须为整数或字符串

array_filter($arr,fun)将值依次传入回调,返回true则出现在结果数组中

array_walk($arr,fun)1.遍历fun($v,$k)2.更新元素fun(&$v,$k,$suffix){return $v.=$suffix;}

array_walk($arr,'fun','_我是后缀');

array_map(fun,$arr1,$arr2,...)将回调作用与多个数组,回调的参数与数组数量必须一样且一一对应,每个数组的数量也需要一致 返回一个新数组

sort(¥arr)升序rsort()降序 ksort()krsort()按键排序asort()arsort()保留键值对应关系排序

array_multisort($arr1,SORT_ASC,$arr2,SORT_DESC)对多个数组排序,升、降

对多维数组<排序>,先用foreach将数组分成多个新数组———>$arrName[],$arrAge[],$arrSex[];

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!