http://zanyzebra-web-hosting.ca/data/white/6971-name-matchmaking.php Please e-mail me if you think otherwise or see room for improvement.
E-mail validator function that supports IPv6 and checking length. I managed to get this to work with PHP 5.
The range options are also smart enough to recognize when the boundaries are exceeded in different bases. Below is a wrapper that I believe validates every legal routable address.
If it is an international domain name, you have to have the php-intl package installed. It is important to note that though the data type of the first parameter of the function is stated as "mixed", this is only one half of the truth.
While it accepts any data type, the first parameter will always be cast to string before being validated or sanitized. It seems that this function was designed strictly to be used on user input strings.
For example: from an online-form. When using it for anything other than that, you may see issues. So read the documentation very carefully! This will allow you to work-around unexpected behavior on non-string input and add your custom checks, or back-port filters or sanitizers that may be added in later versions of PHP.
Thus there actually is a chance that we may see a need for custom filters or backports at some point in the future. I often use XML files as configuration files and use a function that returns a string from the config file via xpath.
While this worked fine before 5. Return Values Returns the stripped string. Changelog Version Description 5.
Test paragraph. The above seems to be saying that, since 5.
Note that allowing anchor tags or href attributes opens another potential security hole that this solution won't protect against. You'll need more comprehensive protection if you plan to allow links in your text.
Caution: the function doesn't fully validate tags the more so HTML itself , it just force strips those obviously broken in addition to stripping forbidden tags. For complex logic consider using DOM parser. A word of caution. This is a very simple but effective function to remove html tags. This is still working in v7.