how can i arrange array like this : <p>I have array like below:</p>

<p>$matrix = array(1, 2, 1,1, 2, 1,1, 1, 1);</p>

<p>how can I get array like below?</p>

<pre><code>//OUTPUT:
minesweeper(matrix) = [[1, 2, 1],
                       [2, 1, 1],
                       [1, 1, 1]]
</code></pre>
