title: PHP: Static method in Class vs Global function in Namespace?
body: <p>What's the difference between creating a Global function in a Namespace (and calling it from the global namespace):</p>
  
  <pre><code>&lt;?php
  namespace MyNamespace  {
      function MyFunction($x, $y)  {
          return $x + $y;
      }
  }
  
  namespace {  //global code... in a new file
     var_dump(MyNamespace\MyFunction(1,2));
  }
  </code></pre>
  
  <p>and creating a static class method, and calling from the global Namespace?:</p>
  
  <pre><code>&lt;?php
  class MyClass  {
      public static function MyFunction($x, $y)  {
          return $x + $y;
      }
  }
  
  var_dump(MyClass::MyFunction(1,2));
  </code></pre>
  
  <p>Is there any reason to prefer one method over the other?</p>