PHP 5.5+ filtering pattern implementation