title: What is the real way to sanitize user input and output safely and conveniently
body: <p>Security should always be the first thing to consider, right? I think this question is so important that someone should have asked before, but I didn't find a satisfying answer for me in search results.</p>
  
  <p>I need both to store user's article contents in database and output it safely. But there's so many ways to do this. I can do this using <code>filter_var()</code> ,<code>strip_tags()</code>, <code>mysql_real_escape_string()</code>,<code>stripslashes()</code>...etc. I can't chose one to use, and i can't confirm whether it's safe enough to use one of them.</p>
  
  <p>What is the best practice for sanitizing input and output?</p>