public function rule_phone($a) { if (strlen(preg_replace('/[^0-9]/', '', $a)) < 6) { return $this->fail('must contain valid phone number'); } }