title: In PHP i have used the logic to find the digits in a number, but i get a default output which is "325" instead of "4" for four digit number
body: <p><strong>Here is the Code below, please review and provide me a solution. It will be very helpful</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;body&gt;
  &lt;?php
  $x=0;   
  $num=1000;
  do{
      $x++;
      $num/=10;
  
  }while($num!=0);
  echo "$x";
  
  ?&gt;  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>