W3cubDocs

/PHP

Spoofchecker::areConfusable

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

Spoofchecker::areConfusableChecks if given strings can be confused

Description

public Spoofchecker::areConfusable ( string $str1 , string $str2 [, string &$error ] ) : bool

Checks whether two given strings can easily be mistaken.

Parameters

str1

First string to check.

str2

Second string to check.

error

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

Return Values

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

Examples

Example #1 Spoofchecker::areConfusable() example

<?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

© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/spoofchecker.areconfusable.php