hkothari Posted December 16, 2009 Share Posted December 16, 2009 So I'm trying to sort a simple array with 5 numbers in it, defined as so: $array = array(123, 140, 3123, 3000, 545); Then I try to sort it using the sort() function as so. sort($array); and that didn't work, so I tried adding the SORT_NUMERIC parameter, but that didn't help. Then I tried to print the output of sort because I know it returns a boolean on success, but it didn't return anything. Does anybody know what's happening? I've tried var_dumping before and after the sort and nothing is done. Link to comment https://forums.phpfreaks.com/topic/185335-php-sort-not-doing-anything/ Share on other sites More sharing options...
trq Posted December 16, 2009 Share Posted December 16, 2009 Post your actual code. Link to comment https://forums.phpfreaks.com/topic/185335-php-sort-not-doing-anything/#findComment-978377 Share on other sites More sharing options...
hkothari Posted December 16, 2009 Author Share Posted December 16, 2009 That is my actual code, except I have a var_dump($array); at the end. $data = array(123, 140, 3123, 3000, 545); sort($data); var_dump($data); Link to comment https://forums.phpfreaks.com/topic/185335-php-sort-not-doing-anything/#findComment-978381 Share on other sites More sharing options...
trq Posted December 16, 2009 Share Posted December 16, 2009 Outputs.... array(5) { [0]=> int(123) [1]=> int(140) [2]=> int(545) [3]=> int(3000) [4]=> int(3123) } Here using 5.3 Link to comment https://forums.phpfreaks.com/topic/185335-php-sort-not-doing-anything/#findComment-978385 Share on other sites More sharing options...
hkothari Posted December 16, 2009 Author Share Posted December 16, 2009 Hm, that's weird, I'll check my code when I get home I guess, thank you anyways. Link to comment https://forums.phpfreaks.com/topic/185335-php-sort-not-doing-anything/#findComment-978388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.