Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
配列を降順で (キーではなく) 値で並べ替える関数はありますか? 以下は、ソートされる配列です。
array( 0 => 3223, 1 => 675, 2 => 56, 3 => 66899, )
asort()そしてarsort()これをします。
asort()
arsort()
http://www.php.net/manual/en/function.asort.php
これを試してください
<?php $fruits = array("lemon", "orange", "banana", "apple"); rsort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val\n"; } ?>
私はそれがあなたを助けてくれることを願っています
http://php.net/manual/en/function.rsort.phpも参照してください