php网页元素进行数组排序的方法

 2022-03-13    538  

实例说明:

<?php
$cars=array("Volvo","BMW","Toyota"); 
sort($cars); 
print_r($cars);
?>

标签含义:

sor            对数组进行升序排列

rsort         对数组进行降序排列

asort        根据关联数组的值,对数组进行升序排列

ksort        根据关联数组的键,对数组进行升序排列

arsort      根据关联数组的值,对数组进行降序排列

krsort      根据关联数组的键,对数组进行降序排列

源代码运行结果如下:

QQ截图20220313144209.png


  •  标签:  
  • php
  •  

原文链接:https://77isp.com/post/437.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。