PHP function that accepts a JSON encoded array : <p>I was solving some math matrix problem, and I got idea to write PHP function that accepts a JSON encoded array and:</p>

<p>1) Sort first row of the given matrix (2D array) in ascending order. During the sorting, other rows should be moved like they are sticked to the first row (you are moving all columns when sorting first row).</p>

<p>2) Find the biggest number in the sorted 2D array except of first row. Then calculate the sum of the biggest number's coordinates (coordinates are starting at [1, 1]).</p>

<p>-- First row is only for sorting, it is not used for calculations</p>

<p>-- If the biggest number exist in more than one row then all coordinates of  this biggest number have to be added to the sum) </p>

<p>Example of matrix (2D array) is:</p>

<p>6 3 9</p>

<p>9 1 6</p>

<p>4 7 9</p>

<p>Solution to the example is following:</p>

<p>6 3 9  =>  3 6 9  => 3 6 9</p>

<p>9 1 6  =>  1 9 6  => 1 <strong>9</strong> 6 => 9 (2, 2) and 9 (3, 3) => (2 + 2) + (3 + 3) => 10</p>

<p>4 7 9  =>  7 4 9 =>  7 4 <strong>9</strong></p>

<p>But, at the moment,I`m beginner in PHP and such code is above my skill, so I need some help.</p>

<p>First part is PHP array, but how to write such array with values found with coordinates as index. As you see, I`m stuck at the beginning of the problem!</p>
