codeigniter validate integer in php

$this->form_validation->set_rules('age', 'Age', 'required|integer');
  1. $this->form_validation - Refers to the form validation library in CodeIgniter.
  2. set_rules - Method used to set rules for a specific form field.
  3. 'age' - Name of the form field to be validated.
  4. 'Age' - Error message label for the form field in case validation fails.
  5. 'required' - Makes the field mandatory.
  6. 'integer' - Validates that the input is a valid integer. ```