Home arrow PHP arrow Checking Boolean Values with Filters in PHP 5

Checking Boolean Values with Filters in PHP 5

Among the numerous libraries that come included by default with the PHP 5 distribution, thereís one that has been overlooked by many developers. This is a shame, because it can be really useful for validating incoming data in a truly simple fashion. Iím talking about the filter extension, a powerful set of functions that let programmers apply several filters to multiple PHP variables to perform all sorts of clever validations, ranging from checking for integer and float numbers, to verifying email addresses and URLs.

TABLE OF CONTENTS:
  1. Checking Boolean Values with Filters in PHP 5
  2. Review: the FILTER_VALIDATE_INT filter
  3. Validating Boolean values with the FILTER_VALIDATE_BOOLEAN filter
  4. Evaluating FALSE values with the filter_var() function
By: Alejandro Gervasio
Rating: starstarstarstarstar / 0
July 29, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Therefore, if you feel curious and wish to learn how to incorporate the filter extension into your web developerís toolbox, then donít hesitate anymore; start reading this group of articles now!

Welcome to the third part of the series on using filters in PHP 5. Comprised of seven tutorials, this series gently introduces you to using the filter library that comes packaged with PHP 5. It shows you with numerous examples how to get the most out of each filter to perform strong validation on the inputted data handled by your web applications.

And now that youíre aware of the goal of this series, itís time to review the topics that were covered in the last part of the series. So, in simple terms, during that particular article, I explained how to use the FILTER_VALIDATE_INT filter, in conjunction with the ďfilter_var()Ē function, to validate octal and hexadecimal integers. In both cases, a ďflagĒ option was passed to the function to perform the data checking process.

Nonetheless, as I said before, the filter extension can be used for more than validating integers, since it provides the required functionality to checking other data types. Thus, in the next few lines Iím going to discuss how to use the extension for validating Boolean values. Does this sound good to you? Then please read the following section.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

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