2024 年 PHP Conference Japan

Spoofchecker::areConfusable

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

Spoofchecker::areConfusable檢查給定的字串是否容易混淆

說明

public Spoofchecker::areConfusable(字串 $string1, 字串 $string2, 整數 &$errorCode = null): 布林值

檢查兩個給定的字串是否容易被誤認。

參數

string1

要檢查的第一個字串。

字串2 (string2)

第二個要檢查的字串。

錯誤碼 (errorCode)

此變數以傳址方式設定為 整數 (int) 型態,包含錯誤碼(如果有的話)。

回傳值

如果兩個給定的字串容易混淆,則回傳 true,否則回傳 false

範例

範例 #1 Spoofchecker::areConfusable() 範例

<?php
$checker
= new Spoofchecker();

$checker->areConfusable('google.com', 'goog1e.com'); // true
// 小寫 l 可能與數字 1 混淆

$checker->areConfusable('google.com', 'g00g1e.com'); // false
// 零 (0) 不容易與字母 "o" 混淆

新增註記

使用者貢獻的註記

此頁面沒有使用者貢獻的註記。
To Top