[dev] Sorting arrays with integers

Xavier Perseguers pub at perseguers.ch
Wed Aug 10 04:22:15 PDT 2005


Hello,

I use Horde_Array::arraySort() to sort items based on a column name in a 
project.

-------
require 'Horde/Array.php';

$table = array(array('name' => 'c',
                      'val'  => '10'),
                array('name' => 'd',
                      'val'  => '6'),
                array('name' => 'a',
                      'val'  => '20'));

Horde_Array::arraySort($table, 'val');

echo '<pre>'; print_r($table); echo '</pre>';
-------

gives me values in following order: 10, 20, 6 instead of (human natural) 
6, 10, 20.

How can I change this?

Thanks
Xavier Perseguers


More information about the dev mailing list