简体   繁体   中英

Order by desc with Textable Class

I want it to arrange the data in descending order.

Now the data is like this:

1
2
3

I want to sort data like this:

3
2
1

This is the code:

full code : http://www.phpkode.com/source/s/textable/textable/textable.class.php

function read_table(){
    $lines = file($this->filename);
    foreach ( $lines as $row ){
        if (strlen($row) > 1){
            $temp = explode("~", $row);
            $temp[count($temp) - 1] = rtrim($temp[count($temp) - 1]);
            $this->table[] = $temp;
        }
    }
}

将值推入数组,然后使用arsort() ,这将创建一个数组,其值按降序排列。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM