I have a associative array and i wanted to print out all the column values at once rather by each row
Example if i have a array of
1.1, 1.2, 1.3, 1.4
2.1, 2.2, 2.3, 2.4
3.1, 3.2, 3.3, 3.4
Currently is displaying 1.1 1.2 1.3 1.4 then 2.1 2.2 2.3 2.4 …etc
but I wanted to display 1.1 ,2.1, 3.1 then 1.2 2.2 3.2 … etc
In c++ i know you have to use nested for loop in order to achieve this
for (int i=0; i< col_size; i++)
{
for (int j=0; j < row_size; j++)
{
cout << a[i][j];
}
}
But how can it be done using associative array in PHP?
Thanks so much!
Outputs
See http://codepad.org/I2AysS5X
Note the
[$j][$i]instead of[$i][$j]