public function rule_int($a) { if (!preg_match('/^[0-9]*$/', $a)) { return $this->fail('Must be an integer: eg 1234'); } }