what type of input should I be using htmlspecialchars with? or should I always use it to sanitize input data? or are there any better 'data sanitizing' functions? That is assuming that these values will be stored in a database
Example:
$userdata = array(
'username' => $_POST['username'],
'email' => $_POST['email'],
'password' => $_POST['password']
);
// register function defined in a class user accepts array as parameter
// register function hashes password before storage
$this->user->register($userdata);
should i apply htmlspecialchars to these data?