/    Sign up×
Community /Pin to ProfileBookmark

can i sort from highest to lowest or vice versa the value of an array?

can an array be sorted from highest to lowest or vice versa?
here’s an example

[CODE]
$testarray [] = array (“7”,
“6”,
“3”,
“3”,
“4”,
“2”,
“1”) ;

print_r($testarray);
[/CODE]

can i show it as something like this:

[QUOTE]

Array ( [0] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) )

[/QUOTE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 26.2008 — [url=www.php.net/sort]sort[/url]()

[url=www.php.net/rsort]rsort[/url]()
×

Success!

Help @nebchill26 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...