I have a 2-D array of integers. I'd like to initialize it in column order, and then access it in row order. Is it possible to initialize in PHP in column order without explicitly iterating over every row?
For example, in R, one can do
my2d = matrix(nrow=2, ncol=2) # create 2x2 matrix
my2d[,1] = c("a","c") # initialize column 1 in a single statement
my2d[,2] = c("b","d") # initialize column 2 in a single statement
print(my2d[1,]) # returns "a" "b"
print(my2d[2,]) # returns "c" "d"