On Tue, Sep 4, 2012 at 9:20 PM, John Taylor-Johnston
<jt.johns...@usherbrooke.ca> wrote:
>
> Here is my code:
> ---------------snip-------------------
> $mynewstring = "http://foo.com/bigtextfile.txt";;
>
> $words = preg_split('/[[:space:]]+/',$mynewstring);
>
> foreach ($words as $word) {
>     $freq[$word]++;
> }
>
> #natcasesort($freq);
> ksort($freq);
>
> John
>
>
> You can try uksort with a custom compare function.
>
> - Matijn
>
>
> Custom compare function?

Yes, for example:
function insensitive_uksort($a,$b) {
    return strtolower($a)<strtolower($b);
}

or use a function like strnatcasecmp.

you can then call
uksort($array, "insensitive_uksort");
or
uksort($array, "strnatcasecmp");

- Matijn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to