<?php class StrHelper { static function normalize($str) { return trim(preg_replace('/\s\s+/', ' ', htmlspecialchars($str))); } }