How to find max number of columns and rows from array in php
<p>I upload a csv and expload it to an array.</p>

<pre><code>array(6) {
  [0]=&gt;
  string(64) "Criteron A-1 bla ,Criteron A-2 bla,Criteron A-3 bla,Criteron A-4 bla,Criteron A-5 bla"
  [1]=&gt;
  string(64) "Criteron B-1 bla,Criteron B-2 bla,Criteron B-3 bla,Criteron B-4 bla,Criteron B-5 bla"
  [2]=&gt;
  string(51) "Criteron C-1 bla,Criteron C-2 bla,Criteron C-3 bla,Criteron C-4 bla"
  [3]=&gt;
  string(38) "Criteron D-1 bla,Criteron D-2 bla,Criteron D-3 bla"
  [4]=&gt;
  string(64) "Criteron E-1,Criteron E-2,Criteron E-3,Criteron E-4,Criteron E-5"
  [5]=&gt;
  string(51) "Criteron F-1,Criteron F-2,Criteron F-3,Criteron F-4"
}
</code></pre>

<p>The original csv has 6 rows and max 5 columns as you see in the above. </p>

<p>In order to put these data in a table, I need to know number of rows and maximum number of columns.</p>

<p>I can find number of rows by using count(). I am thinking to use substr_count() of comma "," for each array and find max then add one to that max to find out the max number of column. (I haven't figure it out how to code the second part yet, though)</p>

<p>I am wondering if you know a better way.</p>

<p>Thanks in advance.</p>
