Jump to content

Sorting strings?


xwishmasterx

Recommended Posts

Also check out the natsort function.

 

Alternatively, you could brute force it with some loops...

 

foreach ($results as $result) {
	list($a, $b) = explode("/", $result);
	$data[$a][] = $b;
}

foreach (ksort($data) as $key => $values) {
	sort($values);
	foreach (sort($value) as $x) {
		print $key . "/" . $x;
	}
}
Not exactly elegant though.
Link to comment
https://forums.phpfreaks.com/topic/284619-sorting-strings/#findComment-1461650
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.