-
- $arr = array(
- "0" => array(line_num => "10", happens_time => "2007-11-19 10:25:04+08" ),
- "1" => array(line_num => "9", happens_time => "2007-11-19 10:25:04+08"),
- "2" => array(line_num = > "25"、発生時刻 => "2007-11-19 10:25:04+08")
- );
- print_r($arr);
- echo "
"; - echo "< ;br />gt;";
- echo "
"; - uasort( $arr,create_function('$a, $b', 'return $a['line_num'] < $b['line_num '];') );
- print_r($arr);
- echo "
"; - echo "
"; - echo "
"; - foreach( $arr as $key => $value) {
- $ar[] = $value;
- }
- print_r($ar);
- ?>
复制代
出結果:
配列
(
[0] => 配列
(
[行番号] => 10
[発生時刻] => 2007-11-19 10:25:04+08
)
[1] => 配列
(
[行番号] => 9
[発生時刻] => 2007-11-19 10:25:04+08
)
[2] => 配列
(
[行番号] => 25
[発生時刻] => 2007-11-19 10:25:04+08
)
)
配列
(
[2] => 配列
(
[行番号] => 25
[発生時刻] => 2007-11-19 10:25:04+08
)
[0] => 配列
(
[行番号] => 10
[発生時刻] => 2007-11-19 10:25:04+08
)
[1] => 配列
(
[行番号] => 9
[発生時刻] => 2007-11-19 10:25:04+08
)
)
配列
(
[0] => 配列
(
[行番号] => 25
[発生時刻] => 2007-11-19 10:25:04+08
)
[1] => 配列
(
[行番号] => 10
[発生時刻] => 2007-11-19 10:25:04+08
)
[2] => 配列
(
[行番号] => 9
[発生時刻] => 2007-11-19 10:25:04+08
)
)
>>> 詳細、请查看 php数组排序方法大全
|