title: Should we namespace functions in PHP?
body: <p>We all know that namespacing your application code is a best practice and a PSR recommendation. The only thing PSRs take stance on is the whitespace and side-effects when it comes to functions and their declaration.</p>
  
  <p>But what about functions which are not related to any single class? Should they be namespaced or left in the global namespace?</p>
  
  <p>Some developers are saying that namespacing functions is bad practice but I wasn't able to grasp why.</p>
  
  <p>From what I've learned/read and seen recommended regarding to namespacing functions:</p>
  
  <ul>
  <li>NO: Don't use global functions without classes as they cannot be auto-loaded (this means creating supporting static classes or similar).</li>
  <li>NO: Don't use global functions as they cannot be imported/used (fully qualified function name is always needed).</li>
  <li>YES: Use namespaces for global functions to prevent collisions and to denote functions that are not part of PHP itself (you can safely assume you're calling the correct function).</li>
  <li>NO: Don't use namespaces for global functions because the functions are not tied to a OO application structure anyways (has a point, but see previous point).</li>
  </ul>
  
  <p>Are there best practices for global functions and namespacing them? Currently I use the application root namespace for global application related functions, but I keep wondering why some people strongly believe no namespacing should happen outside objects (classes, interfaces, traits, etc.)?</p>