PHP
  Home arrow PHP arrow Validating Boolean Values and Float Numbers 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

Validating Boolean Values and Float Numbers with Filters in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2009-08-05


    Table of Contents:
  • Validating Boolean Values and Float Numbers with Filters in PHP 5
  • Review: the FILTER_VALIDATE_BOOLEAN filter
  • Validating Boolean values in arrays
  • Checking for float numbers

  • 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


    Validating Boolean Values and Float Numbers with Filters in PHP 5
    ( Page 1 of 4 )

    Welcome to the fourth part of a series covering the use of filters in PHP. In this article, you'll learn some very useful ways to take advantage of the capabilities of the filter extension to validate Boolean values in arrays; we'll also show you how to validate float numbers.

    If you ever thought that PHP 5 comes mostly from its object model, then fortunately I have to say that you're wrong. The latest version of PHP comes packaged with many other handy features that have contributed enormously to making it the mature language that it is nowadays.

    However, along with its popular improvements, PHP provides a powerful set of filters for performing all sorts of clever validation on variables. These filters can check integers and float numbers, email addresses and URLs, Boolean values and IPs and much, much more.

    This group of filters, also commonly known as "filter extensions," allow you to check for incoming data by using an extremely friendly approach. So if you're searching for a solid library that lets you perform strict validation on user-supplied parameters before doing something useful with them (like inserting them into a database table, for instance), then hopefully this series of articles might be what you need. In it, you'll find a concise guide that will show you how to work with the most useful filters that come bundled with this extension.

    And now that you know what to expect from these tutorials, it's time to quickly review the concepts that were covered in the last one. In that specific installment of the series, I discussed the usage of the FILTER_VALIDATE_BOOLEAN filter. As its name suggests, it was used for checking Boolean values in conjunction with the already familiar "filter_var()" function.

    In addition, it's fair to note that the aforementioned filter was utilized for determining whether or not the value assigned to a single variable was Boolean. As you learned in previous parts of the series, the filter extension permits you to validate elements of a given array very easily as well. Therefore, in this fourth chapter I'm going to explain how to check for Boolean values in arrays, as well as how to validate float numbers using another handy filter.

    Are you ready to continue exploring the numerous capabilities provided by the  PHP 5 filter extension? Then, let's jump in!



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

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - 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...





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