PHP
  Home arrow PHP arrow Checking Boolean Values with Filters in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Checking Boolean Values with Filters in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 0
    2009-07-29


    Table of Contents:
  • Checking Boolean Values with Filters in PHP 5
  • Review: the FILTER_VALIDATE_INT filter
  • Validating Boolean values with the FILTER_VALIDATE_BOOLEAN filter
  • Evaluating FALSE values with the filter_var() function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Checking Boolean Values with Filters in PHP 5
    ( Page 1 of 4 )

    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.

    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
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek