Input_Item Class

The Input_Item class filters the GPCS data.

Quick Example

  1. // Initiate class
  2. $Input = new Input;
  3.  
  4. // fetches the key 'name' from GET
  5. // initiates Input_Item and returns the object
  6. $name = $Input->get ('name');
  7.  
  8. // $name is now an instance of Input_Item
  9.  
  10. echo 'Hello, ', $name->value ('Guest'); // prints 'Guest' if 'name' is not set or invalid.

Filtering the data

  1. $age = $Input->get ('age')->apply_filters (FILTER_VALIDATE_INT);
  2.  
  3. if ($age->is_valid()
  4. // 'age' is validated as an integer
  5.  
  6. if ($age->validate ('in_range', array ('min' => 18, 'max' => 110))) {
  7. // the person is within the age 18-110
  8. }
  9. }

Methods

input_item.txt · Last modified: 2010/07/22 17:27 by davids
Back to top
CC Attribution-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0