array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'spoofchecker.setallowedchars.php', 1 => 'Spoofchecker::setAllowedChars', 2 => 'Set the set of characters allowed when running checks', ), 'up' => array ( 0 => 'class.spoofchecker.php', 1 => 'Spoofchecker', ), 'prev' => array ( 0 => 'spoofchecker.issuspicious.php', 1 => 'Spoofchecker::isSuspicious', ), 'next' => array ( 0 => 'spoofchecker.setallowedlocales.php', 1 => 'Spoofchecker::setAllowedLocales', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/spoofchecker/setallowedchars.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Spoofchecker::setAllowedChars

(PHP 8 >= 8.4.0)

Spoofchecker::setAllowedCharsSet the set of characters allowed when running checks

Beschreibung

public function Spoofchecker::setAllowedChars(string $pattern, int $patternOptions = 0): void

Restricts the characters that are considered acceptable by subsequent checks to the set described by pattern. Any character outside of this set causes Spoofchecker::isSuspicious() to report a result.

Parameter-Liste

pattern
A character set described as a UnicodeSet pattern, that is a regular-expression style character class. It must begin with [ and end with ], for example [a-z0-9].
patternOptions
A bitmask controlling how pattern is interpreted. It must be 0, or Spoofchecker::IGNORE_SPACE on its own or combined with exactly one of Spoofchecker::CASE_INSENSITIVE, Spoofchecker::ADD_CASE_MAPPINGS, or Spoofchecker::SIMPLE_CASE_INSENSITIVE.

Rückgabewerte

No value is returned.

Fehler/Exceptions

Throws a ValueError if pattern is not a valid character set pattern, or if patternOptions is not a valid combination of options.

Beispiele

Beispiel #1 Spoofchecker::setAllowedChars() example

<?php
$checker
= new Spoofchecker();
$checker->setAllowedChars('[a-z0-9]');

var_dump($checker->isSuspicious('hello'));
var_dump($checker->isSuspicious('héllo'));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(false)
bool(true)

Siehe auch