title: Converting Python code to PHP
body: <p>What is the following Python code in PHP?</p>
  
  <pre><code>import sys
  
  li = range(1,777);
  
  def countFigure(li, n):
          m = str(n);
          return str(li).count(m);
  
  # counting figures
  for substr in range(1,10):
          print substr, " ", countFigure(li, substr);
  </code></pre>
  
  <p>Wanted output for 777</p>
  
  <pre><code>1   258
  2   258
  3   258
  4   258
  5   258
  6   258
  7   231
  8   147
  9   147
  </code></pre>