Get array's columns index and merge them into a single dimen
Posted: Thu Jan 14, 2010 10:55 am
Hi guys, i have to do something for today but i'm too excausted so i post for some help, i have an array with 2 dimensions, all i need is to gather the number of column that contains 1 and insert them into one dimensional array. I tried with array_merge() , array_combine and array_fill but i can't find a solution right now.
Assuming the following array1(3x3)
Thanks in advance for your time reading it!
Assuming the following array1(3x3)
Code: Select all
[color=#FF0000] 0 1 2[/color]
[color=#FF0040]0[/color] 0 0 1
[color=#FF0040]1 [/color]1 1 0
[color=#FF0040]2[/color] 0 1 1
I want to create single dimension array2, which will hold the index of the column that contains 1
[color=#FF0040][0][/color]=> 2
[color=#FF0040][1][/color]=> 0, 1 //No of cols, of array1, all in one cell with commas
[color=#FF0040][2][/color]=> 1, 2