title: Performance of static methods vs. functions
body: <p>In PHP, (unlike what I originally thought) there is an overhead of calling static methods vs simple functions.</p>
  
  <p>On a very simple bench, the overhead is over 30% of the calling time
  (the method just returns the parameter):</p>
  
  <pre><code>// bench static method
  $starttime = microtime(true);
  for ($i = 0; $i&lt; 10*1000*1000; $i++)
      SomeClass::doTest($i);
  
  echo "Static Time:   " , (microtime(true)-$starttime) , " ms\n";
  
  // bench object method
  $starttime = microtime(true);
  
  for ($i = 0; $i&lt; 10*1000*1000; $i++)
      $someObj-&gt;doTest($i);
  
  echo "Object Time:   " , (microtime(true)-$starttime) , " ms\n";
  
  // bench function
  $starttime = microtime(true);
  
  for ($i = 0; $i&lt; 10*1000*1000; $i++)
      something_doTest($i);
  
  echo "Function Time: " , (microtime(true)-$starttime) , " ms\n";
  </code></pre>
  
  <p>outputs:</p>
  
  <pre><code>Static Time:   0.640204906464 ms
  Object Time:   0.48961687088 ms
  Function Time: 0.438289880753 ms
  </code></pre>
  
  <p>I know the actual time is still negligible unless I am actually calling something 1 million times, but the fact is that its there.</p>
  
  <p>Will anyone care to try and explain what is happening behind the scenes?<br ></p>
  
  <p>update:<br />
  - added object method bench</p>