PHP Velho Oeste 2024

Spoofchecker::isSuspicious

(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)

Spoofchecker::isSuspiciousVerifica se um texto fornecido contém algum caractere suspeito

Descrição

public Spoofchecker::isSuspicious(string $string, int &$errorCode = null): bool

Verifica se uma string contém algum caractere suspeito como letras que são quase idênticas visualmente, mas são caracteres Unicode de conjuntos diferentes.

Parâmetros

string

String a ser testada.

errorCode

Esta variável é definida por referência para int contendo um erro, se houver algum.

Valor Retornado

Retorna true se houver caracteres suspeitos, false caso contrário.

Exemplos

Exemplo #1 Exemplo de Spoofchecker::isSuspicious()

<?php
$checker
= new Spoofchecker();

$checker->isSuspicious('google.com'); // FALSO: apenas caracteres ASCII

$checker->isSuspicious('Рaypal.com'); // VERDADEIRO
// A primeira letra é do alfabeto cirílico, e não um "P" latino

add a note add a note

User Contributed Notes 1 note

up
0
Anonymous
7 years ago
Example of usage:

$checker = new Spoofchecker();

// false: all letters are in ASCII
var_dump($checker->isSuspicious("goog1e.com"));
// true: the first Cyrillic letter is from different set
var_dump($checker->isSuspicious("Рaypal.com"));

This came from
http://stackoverflow.com/questions/17458876/php-spoofchecker-class
To Top