Home arrow PHP arrow 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.

  1. Working with Regular Expressions with Filters in PHP 5
  2. Review: validating floating numbers with the filter extension
  3. Checking regular expressions with the filter extension
  4. Validating URLs at a basic level
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
August 12, 2009

print this article



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!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: