natsort

Problem with MySQL ORDER BY - can I use natsort to fix it?

I need to use natural sorting with a MySQL result since it currently sorts my INT values as follows: 1 123 1256 22 231 [etc] While I would need it to sort like 1 22 231 1256 I know of the "natsort" function, but it does not work for a MySQL query result. How can I sort (naturally), is it possible to do this within the query? Th...

Python analog of natsort function (sort a list using a "natural order" algorithm)

I would like to know if there is something similar to PHP natsort function in python? l = ['image1.jpg', 'image15.jpg', 'image12.jpg', 'iamge3.jpg'] l.sort() gives: ['image1.jpg', 'image12.jpg', 'image15.jpg', 'iamge3.jpg'] but I would like to get: ['image1.jpg', 'iamge3.jpg', 'image12.jpg', 'image15.jpg'] UPDATE Solution base ...

Why isn't natsort (or natcasesort) working here?

Perhaps I'm doing something embarrassingly wrong, but why isn't this array being sorted? $narray=array(); $dir_handle = @opendir($path.$projectFolder) or die("Unable to open $path$projectFolder"); $i=0; while($file = readdir($dir_handle)) { $filenameSplit = explode('.',$file); if ($file != "." && $file != ".." && $filenameSplit[0...

natsort multidemsional array

Hello I have an multidimensional array like this: array ([0] => array ([id] => 1 [name] => john doe [title] => Mr [days] => 10) [1] => array ([id] => 2 [name] => Joe Smith [title] => Dr [days] => 22) [2] => array ([id] => 3 [name] => John Jones [title] => Mr [days] => 3)) I need to sort the inner arrays so that the data is returne...