title: What are the PHP-specific antipatterns that you know of?
body: <h3>PHP as a Blunt Instrument</h3>
  
  <p>I hear PHP getting bashed around a lot lately. In quite a few projects, I have seen insane php code bases - so bad you really wonder if the person was on hallucinogenic drugs when they wrote the code. Sometimes, I wonder what the code would have been like if the initial developers had a bit more guidance as to what <em>not</em> to do.</p>
  
  <p>However, I have also seen some very well organized PHP projects that were done in 100% OOP and were a pleasure to maintain, but they were not written by "php programmers."</p>
  
  <p>I give all of our junior devs a link to <a href="http://www.odi.ch/prog/design/newbies.php" rel="noreferrer">Java Anti-Patterns</a>. One of the nice things about that page is the Java-specific examples because there are many features of Java that lend themselves to common mistakes. I was hoping to find a similar list for php, but a google search did not reveal anything meaningful.</p>
  
  <p>There are a few questions already out there for <a href="https://stackoverflow.com/questions/306497/what-should-every-php-programmer-know">what a developer should know when programming PHP</a>, but I wanted to focus on the negative.</p>
  
  <p>What are the common things you have seen in PHP that should be avoided and what is a common solution to doing the same thing in a better way?</p>
  
  <p>Some of the obvious examples to me that I think will be mentioned but aren't PHP specific:</p>
  
  <ul>
  <li>Don't concatenate SQL. Use prepare statements or proper escaping.</li>
  <li>Don't blindly embed PHP into HTML - use templating/MVC.</li>
  <li>Don't blindly post raw unfiltered user input - scrub it for XSS attacks.</li>
  <li>Don't manually try to parse all of your POSTs and GETs - use a web framework.</li>
  </ul>
  
  <p>Here would be some examples that I would consider PHP specific:</p>
  
  <ul>
  <li>Don't have too many layers of file include/require linking and try to avoid conditional linking. Rather, have a sane naming convention and be consistent with your organization.</li>
  <li>Don't use PHPs raw database API unless you can help it, instead use a database framework like <a href="http://adodb.sourceforge.net/" rel="noreferrer">ADODB</a> instead.</li>
  <li>Don't overuse PHP's dynamic typing by setting the variable to a string in one place and a boolean somewhere else, then expecting the boolean tests to make sense.</li>
  </ul>
  
  <p>So, what are your favorite PHP <em>don'ts</em> and how do you do it right?</p>