HomePHP Working with Regular Expressions with Filters in PHP 5
Working with Regular Expressions with Filters in PHP 5
Among the enhancements that were introduced originally in PHP 5, thereís one powerful extension that has been all but ignored by many programmers until now, quite possibly because they werenít aware of its existence. Yes, as you might have guessed, Iím talking about the filter library -- a handy set of filters and functions that allow you to validate different types of data with remarkable ease.
Thus, if youíre interested in learning how to put this group of filters to work for you in a very short time, begin reading this series of articles, since in it youíll find the right pointers to get you started using the filter library in a true painless fashion.
However, if you already had the opportunity to read all of the preceding chapters of this series, itís possible that you now have a pretty solid background in utilizing this extension. In those tutorials I used several hands-on examples to explain how to validate integers and float numbers, and to check Boolean values by means of a couple of intuitive PHP functions and simple constants.
Now, speaking more specifically, in the previous article I explained how to use the ďfilter_var()Ē function in conjunction with the FILTER_VALIDATE_FLOAT filter to validate floating numbers assigned to a single scalar variable and stored in arrays, which speaks for itself about the versatility of the filter in question.
Nonetheless, this instructive journey on which we're exploring the capabilities offered by the filter extension doesnít stop there. In this fifth part of the series, Iím going to discuss the usage of the extension for checking if the value that has been assigned to a given variable follows a specified regular expression pattern.
That sounds pretty interesting, right? Therefore, if I've caught your attention, then itís time to continue discovering many other handy validation features provided by the PHP 5 filter library. Letís get going!