waleedahmedwaheed/unique-validator

一个用于实现唯一验证规则的PHP库,例如回文、无重复字符和字母异位词检查。

dev-master 2024-08-02 07:10 UTC

This package is auto-updated.

Last update: 2024-10-02 07:28:59 UTC


README

一个用于实现唯一验证规则的PHP库,例如回文、无重复字符和字母异位词检查。

安装

您可以通过Composer安装此包

composer require waleedahmedwaheed/unique-validator

用法

回文检查

use UniqueValidator\Validator;

if (Validator::isPalindrome('A man, a plan, a canal, Panama')) {
    echo 'This is a palindrome.';
} else {
    echo 'This is not a palindrome.';
}

无重复字符检查

if (Validator::isIsogram('Dermatoglyphics')) {
    echo 'This is an isogram.';
} else {
    echo 'This is not an isogram.';
}

字母异位词检查

if (Validator::isAnagram('listen', 'silent')) {
    echo 'These are anagrams.';
} else {
    echo 'These are not anagrams.';
}

许可证

本项目采用MIT许可证。有关详细信息,请参阅LICENSE文件。