Jump to content

sort() returning '1'?


smerny

Recommended Posts

sort doesn't return the sorted array, it returns a boolean indicating if it was successful or not. It takes the array by reference, so this how you would use it:

 

$arr = explode(',',$_POST['nums']);
sort($arr, SORT_NUMERIC);
print_r($arr);

Link to comment
https://forums.phpfreaks.com/topic/182529-sort-returning-1/#findComment-963400
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.