[Typo3-dev] Sorting without "ORDER BY sorting"

Jeroen Serpieters jeroen at devnulled.nl
Tue Oct 26 17:48:20 CEST 2004


Mathias Schreiber [wmdb>] wrote:
> 
> I tried this one, but a have a associative array.
> is there something like natkcasesort for sorting array keys?
>

You could use uksort() together with strnatcmp() / strnatcasecmp() 
(depending on your wishes).

You could do it like this:

<?php
$a = array(
	"Godzilla 2" => 4,
	"Godzilla 20" => 34,
	"Godzilla 1" => 5,
	"godzilla 12" => 1
);

uksort($a, "strnatcasecmp");

print_r($a);
?>


-- 
Jeroen

* Politics.be (http://www.politics.be/)
*	Jouw politieke portaalsite!

* Politics.be forum (http://forum.politics.be/)
*	Het grootste politieke discussieplatform!




More information about the TYPO3-dev mailing list