protected function isCharsAllowed(&$im) { $c = strlen($this->text); // Special case, if we have 10 digits, the last one can be X if ($c === 10) { if (array_search($this->text[9], $this->keys) === false && $this->text[9] !== 'X') { $this->drawError($im, 'Char \'' . $this->text[9] . '\' not allowed.'); return false; } // Drop the last char $this->text = substr($this->text, 0, 9); } return parent::isCharsAllowed($im); }