public static function isIdentifier($string, $strict = true)
    {
        if ($strict === true) {
            $letter = self::getPerlXmlLetter();
            $digit = self::getPerlXmlDigit();
            $combiningChar = self::getPerlXmlCombiningChar();
            $extender = self::getPerlXmlExtender();

            $string = str_split($string);
            $first = array_shift($string);

            if (preg_match("/(?:_|${letter})/u", $first) === 1) {
                foreach ($string as $s) {
                    if (preg_match("/${letter}|${digit}/u", $s) === 0 && preg_match("/${combiningChar}|${extender}/u", $s) === 0 && preg_match("/_|\\-|\\./u", $s) === 0) {
                        return false;
                    }
                }

                return true;
            } else {
                return false;
            }
        } else {
            return preg_match("/^[a-zA-Z_][a-zA-Z0-9_\.-]*$/u", $string) === 1;
        }
    }
public static function isIdentifier($string, $strict = true)
    {
        if ($strict === true) {
            $letter = self::getPerlXmlLetter();
            $digit = self::getPerlXmlDigit();
            $combiningChar = self::getPerlXmlCombiningChar();
            $extender = self::getPerlXmlExtender();

            $string = str_split($string);
            $first = array_shift($string);

            if (preg_match("/(?:_|${letter})/u", $first) === 1) {
                foreach ($string as $s) {
                    if (preg_match("/${letter}|${digit}/u", $s) === 0 && preg_match("/${combiningChar}|${extender}/u", $s) === 0 && preg_match("/_|\\-|\\./u", $s) === 0) {
                        return false;
                    }
                }

                return true;
            } else {
                return false;
            }
        } else {
            return preg_match("/^[a-zA-Z_][a-zA-Z0-9_\.-]*$/u", $string) === 1;
        }
    }
public static function isIdentifier ( $ string , $ strict = true ) { if ( $ strict === true ) { $ letter = self :: getPerlXmlLetter ( ) ; $ digit = self :: getPerlXmlDigit ( ) ; $ combiningChar = self :: getPerlXmlCombiningChar ( ) ; $ extender = self :: getPerlXmlExtender ( ) ; $ string = str_split ( $ string ) ; $ first = array_shift ( $ string ) ; if ( preg_match ( "/(?:_|${letter})/u" , $ first ) === 1 ) { foreach ( $ string as $ s ) { if ( preg_match ( "/${letter}|${digit}/u" , $ s ) === 0 && preg_match ( "/${combiningChar}|${extender}/u" , $ s ) === 0 && preg_match ( "/_|\\-|\\./u" , $ s ) === 0 ) { return false ; } } return true ; } else { return false ; } } else { return preg_match ( "/^[a-zA-Z_][a-zA-Z0-9_\.-]*$/u" , $ string ) === 1 ; } }
Check if string is compliant with the identifier datatype of IMS QTI.

IMS Global says :
Identifiers can contain the character classes Letter, Digit, Combining which are described in the
Extensible Markup Language (XML) 1.0 (Second Edition). Identifiers should have no more
than 32 characters for compatibility with version 1. They are always compared case-sensitively.

@link http://www.w3.org/TR/2000/REC-xml-20001006
@return boolean Wether $string is a valid identifier.
Check if string is compliant with the identifier datatype of IMS QTI .