What is best way to output posted value?

Is the following code safe?


<?php  echo htmlspecialchars($_POST["message"]);  ?>

What is the best way to echo a value that is posted? Some say use htmlspecialchars. Using this this sufficient?

Some say use striptags(). Other says use addslashes(). And others say use filter_var with FILTER_SANITIZE_STRING.

I would use htmlentities

echo htmlentities($message, ENT_QUOTES);