kopromad Posted January 7, 2013 Share Posted January 7, 2013 Hello. I have a problem I am the Data Entry Operator for this website: http://starforce.bg/?UILanguage=EN (I am giving you the English version on purpose). The problem is that products with numbers at the end do not appear in order. For example in "Ammunition, pellets -> Shotshells and buckshots" products arrange in the following order: 1MB Light 30g N10; 1MB Light 30g N11; 1MB Light 30g N7; 1MB Light 30g N8; 1MB Light 30g N9 So they go like 10,11,7,8,9 not 7,8,9,10,11 It arranges them the right way if I type them with 07,08,09,10,11. Unfortunately I cannot write them like that. Any idea what exactly to search for in the php files. What kind of line exactly. Thank you Link to comment https://forums.phpfreaks.com/topic/272799-problem-with-numbers-arragement-decimal-appear-before-single-ones/ Share on other sites More sharing options...
Barand Posted January 7, 2013 Share Posted January 7, 2013 use natsort() EG $products = array ( '1MB Light 30g N10', '1MB Light 30g N11', '1MB Light 30g N7', '1MB Light 30g N8', '1MB Light 30g N9' ); natsort($products); echo '<pre>'.print_r($products, 1).'</pre>'; RESULTS: Array ( [2] => 1MB Light 30g N7 [3] => 1MB Light 30g N8 [4] => 1MB Light 30g N9 [0] => 1MB Light 30g N10 [1] => 1MB Light 30g N11 ) Link to comment https://forums.phpfreaks.com/topic/272799-problem-with-numbers-arragement-decimal-appear-before-single-ones/#findComment-1403913 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.