title: what is the best why to prevent users insert bad code?
body: <p>I build a site for programme language tutorials , I allow users insert codes from any language, php ,c++ , v...etc ,
  so what is the safe way to insert and display codes ? like our site stackoverflow ? is htmlspecialchars() for insert and htmlspecialchars_decode() for display enough ?</p>