
本文操作系统:windows7系统、PHP5.6版本、DELL G3电脑。
1.排序函数
sort() – 对数组进行升序排列
rsort() – 对数组进行降序排列
asort() – 根据关联数组的值,对数组进行升序排列
ksort() – 根据关联数组的键,对数组进行升序排列
arsort() – 根据关联数组的值,对数组进行降序排列
krsort() – 根据关联数组的键,对数组进行降序排列
2.sort 函数
<?php
$sec="ailx10,ailx12,ailx13,ailx11";
$hack=explode(",",$sec);
sort($hack);
$sec2=implode(",",$hack);
print"排序前:".$sec."\n";
print"排序后:".$sec2;
3.asort 函数
<?php
$hack_biji=array("黑客"=>"hacker",
"网络安全"=>"net_sec",
"人工智能"=>"AI");
asort($hack_biji);
print"排序后:";
foreach($hack_bijias$key=>$value){
print"$key==>$value\n";
}原文来自:https://www.py.cn © 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
















































暂无评论内容