Delete

Hello,

I am wondering if it’s possible to sort an array that is setup like so:

$Array[0] = String1
$Array[1] = String2
$Array[2] = String3
$Array[3] = String4

I loop through a database of URLS and these variables are filled by parsing XML from each URL.

I basically need to sort each result by one of the Array values. There are 3 values: in-game, online, offline. I have been googling all day, but all I come up with is sorting by keys etc. I cannot seem to find a way to sort them by just a variable that is filled.

I hope I explained this well enough and any help is appreciated.

Thank you.

See the usort example #4 if you want to programmatically specify the column to sort by - https://www.php.net/manual/en/function.usort.php

Sponsor our Newsletter | Privacy Policy | Terms of Service