I’m trying to sort my array and I keep getting a result of 1
here is the code pleas help
$foo = array(
2 => "Sports",
40 => "Parent and Families",
43 => "Arts and Entertainment",
);
$foo = sort($foo);
I’d like them to be sorted by value
Sort doesn’t return the sorted array. It returns TRUE of FALSE on success. The array is passed by reference. So call the method and just use it
EDIT
Note however, that sort() actually reassigns your indices. You should use
asort()instead of sort if you want to keep associations