https://wikimass.com/php/matrix-transpose