|
Posted by Oli Filth on 09/29/05 22:19
Stan McCann said the following on 29/09/2005 19:43:
> I need some recommendations as to how to go about sorting a string not
> from the beginning of the string, but from a given index into the
> string. I am reading a data file into an array using file(), then
> looping through the string which contains fields seperated by |. Do I
> have to explode each individual record to sort them using
> array_multisort()? What I was hoping for was something like sort
> ($array, SORT_STRING, 15) where 15 is the index into the string to sort
> on instead of starting at 0. I've been digging through the docs
> reading about sort and usort and the others but nothing looks like it
> will work short of using up time and memory creating a multidimensional
> array to sort.
Well, manipulating data in an array/other data structure is far easier
than trying to do it in-place in a concatenated string.
I would highly recommend exploding it into an array and sorting the array.
--
Oli
Navigation:
[Reply to this message]
|