title: Finding how many digits does every number has in an array in php
body: <p>I have an array which has several numbers.
  What I want to do is get a loop and run into this array and count how many two-digits numbers, three-digits, four-digits numbers do I have.</p>
  <p>What I have tried:</p>
  <pre><code>$myArray = array(123,1234,12345,123456,123567);
  for($i=1,$size=count($myArray);$i&lt;=$size;i++)
  {
  if(strlen($i==3)) echo &quot;the number with index &quot; .$i. &quot; is three-digit number.&quot;;
  else if(strlen($i==4)) echo &quot;the number with index &quot; .$i. &quot; is four-digit number.&quot;;
  ...
  }
  </code></pre>
  <p>I also tried this:</p>
  <pre><code>$threeDigits=0;
  $fourDigits=0;
  $fiveDigits=0;
  $sixDigits=0;
  
  $myArray=(123,1234,12345,123456,1234567,111,222)
  for($i=1,$size=count($myArray);$i&lt;=$size;i++)
  {
  if(strlen($==3)) $threeDigits++;
  else if(strlen($i==4)) $fourDigits++;
  else if(strlen($i==5)) $fiveDigits++;
  else if(strlen($i==6)) $sixDigits++;
  }
  echo &quot;There are &quot; .$fourDigits. &quot; numbers with 4 digits.&quot;;
  echo &quot;There are &quot; .$threeDigits. &quot; numbers with 3 digits.&quot;;
  echo &quot;There are &quot; .$fiveDigits. &quot; numbers with 5 digits.&quot;;
  echo &quot;There are &quot; .$sixDigits. &quot; numbers with 6 digits.&quot;;
  </code></pre>
  <p>But somehow it only reads them as one. As you can see, in my array there are three three-digit numbers but when I print it out it says I have only one. What do you think it might be the problem here?</p>