Array Functions
PHP Manual

rsort

(PHP 4, PHP 5)

rsortمرتب‌سازی آرایه به ترتیب خلاف

Description

bool rsort ( array &$array [, int $sort_flags = SORT_REGULAR ] )

این تابع آرایه را با ترتیب خلاف مرتب می‌کند (از بیشترین به کمترین).

Parameters

array

آرایه ورودی.

sort_flags

شما رفتار مرتب‌سازی را می‌توانید با استفاده از پارامتر اختیاری sort_flags تغییر دهید، برای جزئیات بیشتر sort() را ببینید.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 مثال rsort()

<?php
$fruits 
= array("lemon""orange""banana""apple");
rsort($fruits);
foreach (
$fruits as $key => $val) {
    echo 
"$key = $val\n";
}
?>

The above example will output:

0 = orange
1 = lemon
2 = banana
3 = apple

میوه‌ها براساس ترتیب خلاف حروف الفبا مرتب شده است.

Notes

Note: This function assigns new keys to the elements in array. It will remove any existing keys that may have been assigned, rather than just reordering the keys.

See Also


Array Functions
PHP Manual