eXorithm – Execute Algorithm: Discuss Algorithm sort_multi_array

Logo Beta

sort_multi_array     version 0.1     Sort a two-dimensional array by one (or more) of the elements in the nested arrays. Accepts a variable number of arguments.Subject: Usage Example for sort_multi_array would be useful

optionzz posted: Jan 2, 2014 08:02 pm [reply]

I have a TOUGH time wrapping my head around the strange php array design. All I need to do is use a matrix with numeric indexes for each dimension. Somehow, EVERY example uses names for the "columns" in the second index. If I want that, I’ll use SQL.

Sorry, complaining won’t help. I’d love to see how this would work for a normal 2 dim array like

0 1 2 3

0 (0,0) (0,1) (0,2) (0,3)



2



4 (4,0) (4,1) (4,2) (4,4)

I want to sort all 5 rows based on any of the column NUMBERS (there are no names).

I’m pretty new to PHP but not to programming. Perhaps someone could help break the logjam in my head that REFUSES to understand arrays inside arrays with names instead of numbers, but most importantly, how to make the sort work!

Thanks.

Subject: Usage Example for sort_multi_array would be useful

optionzz posted: Jan 2, 2014 07:58 pm [reply]

I have a TOUGH time wrapping my head around the strange php array design. All I need to do is use a matrix with numeric indexes for each dimension. Somehow, EVERY example uses names for the "columns" in the second index. If I want that, I’ll use SQL.

Sorry, complaining won’t help. I’d love to see how this would work for a normal 2 dim array like

0 1 2 3

0 0,0 0,1 0,2 0,3

1 1,0 1,2…





New Comment