求PHP数组最大值,最小值的代码
程序员文章站
2023-04-07 12:51:04
复制代码 代码如下:
<?php
$fruits = array("155::vbscript:://www.jb51.net/list/list_114_1.htm", "1::javascript:://www.jb51.net/list/list_3_1.htm", "2::正则表达式:://www.jb51.net/list/list_6_1.htm", "3::服务器常用软件::http://s.jb51.net");
print_r($fruits);
rsort($fruits,sort_numeric);
print_r($fruits);
?>
显示结果:
array
(
[0] => 155::vbscript:://www.jb51.net/list/list_114_1.htm
[1] => 1::javascript:://www.jb51.net/list/list_3_1.htm
[2] => 2::正则表达式:://www.jb51.net/list/list_6_1.htm
[3] => 3::服务器常用软件::http://s.jb51.net
)
array
(
[0] => 155::vbscript:://www.jb51.net/list/list_114_1.htm
[1] => 3::服务器常用软件::http://s.jb51.net
[2] => 2::正则表达式:://www.jb51.net/list/list_6_1.htm
[3] => 1::javascript:://www.jb51.net/list/list_3_1.htm
)
复制代码 代码如下:
<?php
$fruits = array("155::vbscript:://www.jb51.net/list/list_114_1.htm", "1::javascript:://www.jb51.net/list/list_3_1.htm", "2::正则表达式:://www.jb51.net/list/list_6_1.htm", "3::服务器常用软件::http://s.jb51.net");
print_r($fruits);
rsort($fruits,sort_numeric);
print_r($fruits);
?>
显示结果:
array
(
[0] => 155::vbscript:://www.jb51.net/list/list_114_1.htm
[1] => 1::javascript:://www.jb51.net/list/list_3_1.htm
[2] => 2::正则表达式:://www.jb51.net/list/list_6_1.htm
[3] => 3::服务器常用软件::http://s.jb51.net
)
array
(
[0] => 155::vbscript:://www.jb51.net/list/list_114_1.htm
[1] => 3::服务器常用软件::http://s.jb51.net
[2] => 2::正则表达式:://www.jb51.net/list/list_6_1.htm
[3] => 1::javascript:://www.jb51.net/list/list_3_1.htm
)
上一篇: PHP中用正则表达式清除字符串的空白
下一篇: js原生开发一个2048小游戏