Home arrow PHP arrow Validating Octal and Hexadecimal Values with Filters in PHP 5

Validating Octal and Hexadecimal Values with Filters in PHP 5

As you know, when it comes to validating incoming data, PHP 5 comes bundled with a powerful set of native functions that allow you to perform all sorts of clever validations on a given variable. This includes checking for numeric values, arrays, strings, and objects as well. However, the best feature of the helpful validation capabilities offered by default by PHP 5 is its handy filter extension, even though it has been overlooked by many programmers so far.

  1. Validating Octal and Hexadecimal Values with Filters in PHP 5
  2. Review: the FILTER_VALIDATE_INT filter
  3. Filtering array elements
  4. Validating octal and hexadecimal integers using the flags option
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
July 22, 2009

print this article



Indeed, this library of filters also permits you to perform powerful validation on variables in a pretty straightforward fashion, without the need to define custom and complex functions. So, if you’re interested in learning how to use these filters within your own web applications, then this group of articles might be the material that you’re looking for.

Logically, if you already had the chance to read the introductory installment of this series, then at this point you’ll have a fairly clear idea of how to use the filter extension for validating integers. In that specific tutorial I coded a few basic examples that demonstrated how to carry out this task by using the FILTER_VALIDATE_INT filter in conjunction with the “filter_var()” function.

Not only did this filter allow us to check whether a given value was an integer or not, but it permitted us to determine if the value in question was within a specified range. This extra functionality was implemented via an additional “option” array, which was passed to the aforementioned “filter_var()” function.

However, I’m only scratching the surface when it comes to exploring the numerous capabilities offered by the filter extension. Therefore, in this second chapter of this series, I’m going to discuss how to use the FILTER_VALIDATE_INT filter that you learned in the previous part, this time for validating array elements as well as octal and hexadecimal integers.

Does this sound complex to you? It won’t be at all, trust me. Now, let’s get rid of the preliminaries and continue exploring the useful validation capacities of the filter PHP 5 extension!

>>> 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: