silverglade Posted July 22, 2008 Share Posted July 22, 2008 i dont understand this function. why doesnt it display the days in their numerical order? any help greatly appreciated , thanks. derek natsort($arrayname) Sorts mixed string/number values in natural order. For example, given an array with values day1, day5, day11, day2, it sorts into the following order: day1, day2, day5, day11. The previous sort functions sort the array into this order: day1, day11, day2, day5. Quote Link to comment https://forums.phpfreaks.com/topic/116008-solved-i-dont-understand-function-natsort/ Share on other sites More sharing options...
samshel Posted July 22, 2008 Share Posted July 22, 2008 normal sort will return day1 day11 day2 day5 natsort should return them as day1 day2 day5 day11 (which i think is happening as you mentioned). so what exactly is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/116008-solved-i-dont-understand-function-natsort/#findComment-596464 Share on other sites More sharing options...
silverglade Posted July 22, 2008 Author Share Posted July 22, 2008 my book says the sort will sort it in the following manner The previous sort functions sort the array into this order: day1, day11, day2, day5. is my book wrong? Quote Link to comment https://forums.phpfreaks.com/topic/116008-solved-i-dont-understand-function-natsort/#findComment-596472 Share on other sites More sharing options...
MadTechie Posted July 22, 2008 Share Posted July 22, 2008 No, its correct read samshel post "The previous sort functions sort" refers to sort() normal sort will return day1 day11 day2 day5 natsort should return them as day1 day2 day5 day11 (which i think is happening as you mentioned). so what exactly is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/116008-solved-i-dont-understand-function-natsort/#findComment-596475 Share on other sites More sharing options...
silverglade Posted July 22, 2008 Author Share Posted July 22, 2008 nevermind thank you. i misunderstood the book. day1, day2, day5, day 11. thank you for helping me, derek Quote Link to comment https://forums.phpfreaks.com/topic/116008-solved-i-dont-understand-function-natsort/#findComment-596480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.