A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearPHP filter() function - why? - page 1
User InfoPosts
PHP filter() function - why?#1
Why would I want to use PHP's filter library? Why wouldn't I?

It seems to try and do a bit of clean-up (it's awful when you have to work with regular expressions), but on the other hand function naming and parameter constants seem to be a disaster, if you ask me. It must have been included in PHP for a reason, but I just don't seem to like it. What am I missing?

Later edit:
Regarding GaryF's answer, I wish to explain a bit why I don't like this function.
This isn't about using it in "my case" if it fits. This is about using it wherever it fits. There's a high chance of needing a filter that won't fit PHP's functions, so I'll have to create my own filter. In that case, the application will use two completely different kinds of functions for data filtering. I consider that to be a much worse practice than just inventing a better wheel.

posted date: 2008-12-15 05:09:00


Re: PHP filter() function - why?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-15 05:09:01


Re: PHP filter() function - why?#3
Probably the best resource for this is the tutorial linked to from the PHP manual page: http://devolio.com/blog/archives/413-Data-Filtering-Using-PHPs-Filter-Functions-Part-one.htmlIt's decent enough for simple filtering, but if you don't find your use-case on that page it probably isn't for you.

posted date: 2008-12-15 05:17:00


Re: PHP filter() function - why?#4
function naming and parameters are a disaster yes but as PHP is a disaster by itself anyway... </controversial>

posted date: 2008-12-15 05:19:00


Re: PHP filter() function - why?#5
I have to say, I strongly agree to this :)

posted date: 2008-12-15 05:56:00


Re: PHP filter() function - why?#6
My stance is that the concept of filtering input data is flawed on a conceptual level. See my reply to the almost similar question What’s the best method for sanitizing user input with PHP?

posted date: 2008-12-15 06:02:00


Re: PHP filter() function - why?#7
It's about using a well-tested data filtering framework to prevent XSS and SQL Injection attacks.If you look at all the possibilities, that is the kind of filtering you don't want to implement yourself.http://www.php.net/manual/en/intro.filter.php

posted date: 2008-12-15 06:03:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.