Back port of the filter_var extension to versions of PHP < 5.2.0