Hướng dẫn normalize string php

normalizer_normalize

[PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0]

Normalizer::normalize -- normalizer_normalize Normalizes the input provided and returns the normalized string

说明

面向对象风格

public static Normalizer::normalize[string $string, int $form = Normalizer::FORM_C]: string|false

normalizer_normalize[string $string, int $form = Normalizer::FORM_C]: string|false

参数

string

The input string to normalize

form

One of the normalization forms.

返回值

The normalized string or false if an error occurred.

范例

示例 #1 normalizer_normalize[] example

示例 #2 OO example

以上例程会输出:

参见

  • normalizer_is_normalized[] - Checks if the provided string is already in the specified normalization form

spam at oscar dot xyz

7 years ago

You can use the 'original' abbreviations if you feel more comfortable:

anrdaemon at freemail dot ru

4 years ago

"If you get error messages while starting apache of xampp package with activated extension=intl.dll," do NOT copy any files around.

Use Apache's "LoadFile …" functionality to load any missing DLL's not found within a %PATH%. Even php##ts.dll itself.

akniep at rayo dot info

13 years ago

Especially when matching texts against each-other or against keywords, it is helpful to normalize the texts before.
The following function removes all diacritics [marks like accents] from a given UTF8-encoded texts and returns ASCii-text.

Be sure to have the PHP-Normalizer-extension [intl and icu] installed.

Tipp: You may also want to map the text to lower case before execute matching procedures ...



The above function is mainly based on the following article:
//ahinea.com/en/tech/accented-translate.html

tom dot vom dot berg at online dot de

8 years ago

If you get error messages while starting apache of xampp package with activated extension=intl.dll, copy the files

    * icudt##.dll
    * icuin##.dll
    * icuio##.dll
    * icule##.dll
    * iculx##.dll
    * icutu##.dll
    * icuuc##.dll

## = version number

from "/program files/xampp/php"
into your "/program files/xampp/apache/bin" or whereever your xampp resides :-]

Chủ Đề