Array (
Array( 1 , 330 )
Array( 1 , 331 )
Array( 1 , 332 )
Array( 12 , 444)
Array( 12 , 445)
Array( 33 , 555)
Array( 33 , 556)
Array( 33 , 557)
Array( 33 , 558)
)
(The first value of the 2nd array(s) will always be in order, 1,12,33,99, ... etc)
My end goal is to end up with an array that looks like this:
Array (
Array( 1 , 330 , 'start')
Array( 1 , 331 , ' ' )
Array( 1 , 332 , 'end')
Array( 12 , 444, 'start')
Array( 12 , 445, 'end')
Array( 33 , 555, 'start')
Array( 33 , 556, ' ' )
Array( 33 , 557, ' ' )
Array( 33 , 558, 'end' )
)
I'm used to writing database code so if you think of this as a table I just want to identify the first and last occurence of each integer in the first column. I started to attempt this by myself but ended up creating lots of smaller arrays and I began to wonder about the efficiency of my approach and whether there were some well-known methods of solving problems like this that would be unfamiliar to someone without a formal computer background like myself. I can't write a mysql sproc for this because I don't have permissions on my server
Ultimately I would use 'end' and 'start' values in the final array to place my encapsulating div and /div tags respectively around the values within each array. This would be soo easy for me in t-sql but I am trying to get out of that habit.
Anyone have a solution or an alternative approach to suggest? [crossing fingers...]
Also, I am not creating a 3 dimensional array out of this because I wasn't very confident that I could output a 3 dimensional array in SMARTY - maybe I am wrong here? But for the sake of science and human progress in general I am still sort of curious what the solution would be to my above question without using a 3 dimensional array...