php8.5
Home/ Manual/ intl / spoofchecker/ Spoofchecker::areConfusable

Spoofchecker::areConfusable

PHP function Edit on GitHub ✎

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

Checks if given strings can be confused

Description

Spoofchecker::areConfusable(string $string1, string $string2, int $errorCode = null): bool

Checks whether two given strings can easily be mistaken.

Parameters

string1

First string to check.

string2

Second string to check.

errorCode

This variable is set by-reference to Integer containing an error, if there was any.

Return Values

Returns true if two given strings can be confused, false otherwise.

Examples

Spoofchecker::areConfusable() example

php
<?php
$checker = new Spoofchecker();

$checker->areConfusable('google.com', 'goog1e.com'); // true
// Lower l can be confused with digit one

$checker->areConfusable('google.com', 'g00g1e.com'); // false
// Zero (0) cannot be easily confused with "o" letter

Source: reference/intl/spoofchecker/areconfusable.xml · from the official PHP manual (php/doc-en)