I think using a singleton would be great even if for practice. Just because someone doesn't think it's the right approach does not make it wrong. By using and implementing ideas, not matter how small or large, you will learn and expand your knowledge of said implementations. You will soon know if it works for your particular situation or not. Then you do not have to take the opinions of others.
That being said, I say go for it. I can see why you would want to. The thought being, "I want everything to be cleaned for injections (etc.) and this way I can make sure it will happen on every input."
Allow me to shed a little light. Why not implement a single method using $_REQUEST that will process both $_GET and $_POST? While this may be a simple approach, it will get you started.
$cleanser = Cleanser::singleton();
$new_request_array = $cleanser->clean($_REQUEST);
class Cleanser
{
private static $instance;
private function __construct() { }
public static function singleton() {
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
public function clean($request) {
foreach($request as $key => $value) {
// perform any cleansing here
$cleansed[$key] = trim($value);
}
return $cleansed;
}
public function __clone() {
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
}
Have fun and remember, there is nothing "wrong" or "incorrect" when it comes to learning. I think that is the approach StackOverflow is trying to make. We are hear to learn how to do something, not be judged on our implementation of it. So have fun!