2017 © Pedro PelĂĄez
 

library portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

image

voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  • Tuesday, June 12, 2018
  • by voku
  • Repository
  • 14 Watchers
  • 183 Stars
  • 406,198 Installations
  • PHP
  • 20 Dependents
  • 1 Suggesters
  • 28 Forks
  • 0 Open issues
  • 100 Versions
  • 12 % Grown

The README.md

SWUbanner, (*1)

Build Status Build status FOSSA Status codecov.io Codacy Badge Latest Stable Version Total Downloads License Donate to this project using PayPal Donate to this project using Patreon, (*2)

🉑 Portable UTF-8

Description

It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your server., (*3)

The benefit of Portable UTF-8 is that it is easy to use, easy to bundle. This library will also auto-detect your server environment and will use the installed php-extensions if they are available, so you will have the best possible performance., (*4)

As a fallback we will use Symfony Polyfills, if needed. (https://github.com/symfony/polyfill), (*5)

The project based on ... + Hamid Sarfraz's work - portable-utf8 + Nicolas Grekas's work - tchwork/utf8 + Behat's work - Behat/Transliterator + SebastiĂĄn Grignoli's work - neitanod/forceutf8 + Ivan Enderlin's work - hoaproject/Ustring + and many cherry-picks from "GitHub"-gists and "Stack Overflow"-snippets ..., (*6)

Demo

Here you can test some basic functions from this library and you can compare some results with the native php function results., (*7)

Index

Alternative

If you like a more Object Oriented Way to edit strings, then you can take a look at voku/Stringy, it's a fork of "danielstjules/Stringy" but it used the "Portable UTF-8"-Class and some extra methods., (*8)

// Standard library
strtoupper('fòôbàř');       // 'FòôBàř'
strlen('fòôbàř');           // 10

// mbstring 
// WARNING: if you don't use a polyfill like "Portable UTF-8", you need to install the php-extension "mbstring" on your server
mb_strtoupper('fòôbàř');    // 'FÒÔBÀŘ'
mb_strlen('fòôbàř');        // '6'

// Portable UTF-8
use voku\helper\UTF8;
UTF8::strtoupper('fòôbàř');    // 'FÒÔBÀŘ'
UTF8::strlen('fòôbàř');        // '6'

// voku/Stringy
use Stringy\Stringy as S;
$stringy = S::create('fòôbàř');
$stringy->toUpperCase();    // 'FÒÔBÀŘ'
$stringy->length();         // '6'

Install "Portable UTF-8" via "composer require"

composer require voku/portable-utf8

If your project do not need some of the Symfony polyfills please use the replace section of your composer.json. This removes any overhead from these polyfills as they are no longer part of your project. e.g.:, (*9)

{
  "replace": {
    "symfony/polyfill-php72": "1.99",
    "symfony/polyfill-iconv": "1.99",
    "symfony/polyfill-intl-grapheme": "1.99",
    "symfony/polyfill-intl-normalizer": "1.99",
    "symfony/polyfill-mbstring": "1.99"
  }
}

Why Portable UTF-8?

PHP 5 and earlier versions have no native Unicode support. To bridge the gap, there exist several extensions like "mbstring", "iconv" and "intl"., (*10)

The problem with "mbstring" and others is that most of the time you cannot ensure presence of a specific one on a server. If you rely on one of these, your application is no more portable. This problem gets even severe for open source applications that have to run on different servers with different configurations. Considering these, I decided to write a library:, (*11)

Requirements and Recommendations

  • No extensions are required to run this library. Portable UTF-8 only needs PCRE library that is available by default since PHP 4.2.0 and cannot be disabled since PHP 5.3.0. "\u" modifier support in PCRE for UTF-8 handling is not a must.
  • PHP 5.3 is the minimum requirement, and all later versions are fine with Portable UTF-8.
  • PHP 7.0 is the minimum requirement since version 4.0 of Portable UTF-8, otherwise composer will install an older version
  • PHP 8.0 support is also available and will adapt the behaviours of the native functions.
  • To speed up string handling, it is recommended that you have "mbstring" or "iconv" available on your server, as well as the latest version of PCRE library
  • Although Portable UTF-8 is easy to use; moving from native API to Portable UTF-8 may not be straight-forward for everyone. It is highly recommended that you do not update your scripts to include Portable UTF-8 or replace or change anything before you first know the reason and consequences. Most of the time, some native function may be all what you need.
  • There is also a shim for "mbstring", "iconv" and "intl", so you can use it also on shared webspace.

Usage

Example 1: UTF8::cleanup(), (*12)

  echo UTF8::cleanup('�Dßsseldorf�');

  // will output:
  // DĂźsseldorf

Example 2: UTF8::strlen(), (*13)

  $string = 'string <strong>with utf-8 chars üèä</strong> - doo-bee doo-bee dooh';

  echo strlen($string) . "\n<br />";
  echo UTF8::strlen($string) . "\n<br />";

  // will output:
  // 70
  // 67

  $string_test1 = strip_tags($string);
  $string_test2 = UTF8::strip_tags($string);

  echo strlen($string_test1) . "\n<br />";
  echo UTF8::strlen($string_test2) . "\n<br />";

  // will output:
  // 53
  // 50

Example 3: UTF8::fix_utf8(), (*14)


echo UTF8::fix_utf8('Dßsseldorf'); echo UTF8::fix_utf8('ä'); // will output: // Dßsseldorf // ä

Portable UTF-8 | API

The API from the "UTF8"-Class is written as small static methods that will match the default PHP-API., (*15)

Class methods

, (*16)

access add_bom_to_string array_change_key_case between
binary_to_str bom callback char_at
chars checkForSupport chr chr_map
chr_size_list chr_to_decimal chr_to_hex chunk_split
clean cleanup codepoints collapse_whitespace
count_chars css_identifier css_stripe_media_queries ctype_loaded
decimal_to_chr decode_mimeheader emoji_decode emoji_encode
emoji_from_country_code encode encode_mimeheader extract_text
file_get_contents file_has_bom filter filter_input
filter_input_array filter_var filter_var_array finfo_loaded
first_char fits_inside fix_simple_utf8 fix_utf8
getCharDirection getSupportInfo getUrlParamFromArray get_file_type
get_random_string get_unique_string has_lowercase has_uppercase
has_whitespace hex_to_chr hex_to_int html_encode
html_entity_decode html_escape html_stripe_empty_tags htmlentities
htmlspecialchars iconv_loaded int_to_hex intlChar_loaded
intl_loaded is_alpha is_alphanumeric is_ascii
is_base64 is_binary is_binary_file is_blank
is_bom is_empty is_hexadecimal is_html
is_json is_lowercase is_printable is_punctuation
is_serialized is_uppercase is_url is_utf8
is_utf16 is_utf32 json_decode json_encode
json_loaded lcfirst lcwords levenshtein
ltrim max max_chr_width mbstring_loaded
min normalize_encoding normalize_line_ending normalize_msword
normalize_whitespace ord parse_str pcre_utf8_support
range rawurldecode regex_replace remove_bom
remove_duplicates remove_html remove_html_breaks remove_ileft
remove_invisible_characters remove_iright remove_left remove_right
replace replace_all replace_diamond_question_mark rtrim
showSupport single_chr_html_encode spaces_to_tabs str_camelize
str_capitalize_name str_contains str_contains_all str_contains_any
str_dasherize str_delimit str_detect_encoding str_ends_with
str_ends_with_any str_ensure_left str_ensure_right str_humanize
str_iends_with str_iends_with_any str_insert str_ireplace
str_ireplace_beginning str_ireplace_ending str_istarts_with str_istarts_with_any
str_isubstr_after_first_separator str_isubstr_after_last_separator str_isubstr_before_first_separator str_isubstr_before_last_separator
str_isubstr_first str_isubstr_last str_last_char str_limit
str_limit_after_word str_longest_common_prefix str_longest_common_substring str_longest_common_suffix
str_matches_pattern str_obfuscate str_offset_exists str_offset_get
str_pad str_pad_both str_pad_left str_pad_right
str_repeat str_replace_beginning str_replace_ending str_replace_first
str_replace_last str_shuffle str_slice str_snakeize
str_sort str_split str_split_array str_split_pattern
str_starts_with str_starts_with_any str_substr_after_first_separator str_substr_after_last_separator
str_substr_before_first_separator str_substr_before_last_separator str_substr_first str_substr_last
str_surround str_titleize str_titleize_for_humans str_to_binary
str_to_lines str_to_words str_truncate str_truncate_safe
str_underscored str_upper_camelize str_word_count strcasecmp
strcmp strcspn string string_has_bom
strip_tags strip_whitespace stripos stripos_in_byte
stristr strlen strlen_in_byte strnatcasecmp
strnatcmp strncasecmp strncmp strpbrk
strpos strpos_in_byte strrchr strrev
strrichr strripos strripos_in_byte strrpos
strrpos_in_byte strspn strstr strstr_in_byte
strtocasefold strtolower strtoupper strtr
strwidth substr substr_compare substr_count
substr_count_in_byte substr_count_simple substr_ileft substr_in_byte
substr_iright substr_left substr_replace substr_right
swapCase symfony_polyfill_used tabs_to_spaces titlecase
to_ascii to_boolean to_filename to_int
to_iso8859 to_string to_utf8 to_utf8_string
trim ucfirst ucwords urldecode
utf8_decode utf8_encode whitespace_table words_limit
wordwrap wordwrap_per_line ws

access(string $str, int $pos, string $encoding): string

↑ Return the character at the specified position: $str1 like functionality., (*17)

EXAMPLE: UTF8::access('fòô', 1); // 'ò', (*18)

Parameters: - string $str <p>A UTF-8 string.</p> - int $pos <p>The position of character to return.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*19)

Return: - string <p>Single multi-byte character.</p>, (*20)


add_bom_to_string(string $str): non-empty-string

↑ Prepends UTF-8 BOM character to the string and returns the whole string., (*21)

INFO: If BOM already existed there, the Input string is returned., (*22)

EXAMPLE: UTF8::add_bom_to_string('fòô'); // "\xEF\xBB\xBF" . 'fòô', (*23)

Parameters: - string $str <p>The input string.</p>, (*24)

Return: - non-empty-string <p>The output string that contains BOM.</p>, (*25)


array_change_key_case(array $array, int $case, string $encoding): string[]

↑ Changes all keys in an array., (*26)

Parameters: - array<string, mixed> $array <p>The array to work on</p> - int $case [optional] <p> Either <strong>CASE_UPPER</strong><br> or <strong>CASE_LOWER</strong> (default)</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*27)

Return: - string[] <p>An array with its keys lower- or uppercased.</p>, (*28)


between(string $str, string $start, string $end, int $offset, string $encoding): string

↑ Returns the substring between $start and $end, if found, or an empty string. An optional offset may be supplied from which to begin the search for the start string., (*29)

Parameters: - string $str - string $start <p>Delimiter marking the start of the substring.</p> - string $end <p>Delimiter marking the end of the substring.</p> - int $offset [optional] <p>Index from which to begin the search. Default: 0</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*30)

Return: - string, (*31)


binary_to_str(string $bin): string

↑ Convert binary into a string., (*32)

INFO: opposite to UTF8::str_to_binary(), (*33)

EXAMPLE: UTF8::binary_to_str('11110000100111111001100010000011'); // '😃', (*34)

Parameters: - string $bin 1|0, (*35)

Return: - string, (*36)


bom(): non-empty-string

↑ Returns the UTF-8 Byte Order Mark Character., (*37)

INFO: take a look at UTF8::$bom for e.g. UTF-16 and UTF-32 BOM values, (*38)

EXAMPLE: UTF8::bom(); // "\xEF\xBB\xBF", (*39)

Parameters: nothing, (*40)

Return: - non-empty-string <p>UTF-8 Byte Order Mark.</p>, (*41)


callback(callable(string): string $callback, string $str): string[]

↑, (*42)

Parameters: - callable(string): string $callback - string $str, (*43)

Return: - string[], (*44)


char_at(string $str, int $index, string $encoding): string

↑ Returns the character at $index, with indexes starting at 0., (*45)

Parameters: - string $str <p>The input string.</p> - int<1, max> $index <p>Position of the character.</p> - string $encoding [optional] <p>Default is UTF-8</p>, (*46)

Return: - string <p>The character at $index.</p>, (*47)


chars(string $str): string[]

↑ Returns an array consisting of the characters in the string., (*48)

Parameters: - T $str <p>The input string.</p>, (*49)

Return: - string[] <p>An array of chars.</p>, (*50)


checkForSupport(): true|null

↑ This method will auto-detect your server environment for UTF-8 support., (*51)

Parameters: nothing, (*52)

Return: - true|null, (*53)


chr(int $code_point, string $encoding): string|null

↑ Generates a UTF-8 encoded character from the given code point., (*54)

INFO: opposite to UTF8::ord(), (*55)

EXAMPLE: UTF8::chr(0x2603); // '☃', (*56)

Parameters: - int $code_point <p>The code point for which to generate a character.</p> - string $encoding [optional] <p>Default is UTF-8</p>, (*57)

Return: - string|null <p>Multi-byte character, returns null on failure or empty input.</p>, (*58)


chr_map(callable(string): string $callback, string $str): string[]

↑ Applies callback to all characters of a string., (*59)

EXAMPLE: UTF8::chr_map([UTF8::class, 'strtolower'], 'Κόσμε'); // ['κ','ό', 'σ', 'μ', 'ε'], (*60)

Parameters: - callable(string): string $callback - string $str <p>UTF-8 string to run callback on.</p>, (*61)

Return: - string[] <p>The outcome of the callback, as array.</p>, (*62)


chr_size_list(string $str): int[]

↑ Generates an array of byte length of each character of a Unicode string., (*63)

1 byte => U+0000 - U+007F 2 byte => U+0080 - U+07FF 3 byte => U+0800 - U+FFFF 4 byte => U+10000 - U+10FFFF, (*64)

EXAMPLE: UTF8::chr_size_list('中文空白-test'); // [3, 3, 3, 3, 1, 1, 1, 1, 1], (*65)

Parameters: - T $str <p>The original unicode string.</p>, (*66)

Return: - int[] <p>An array of byte lengths of each character.</p>, (*67)


chr_to_decimal(string $char): int

↑ Get a decimal code representation of a specific character., (*68)

INFO: opposite to UTF8::decimal_to_chr(), (*69)

EXAMPLE: UTF8::chr_to_decimal('§'); // 0xa7, (*70)

Parameters: - string $char <p>The input character.</p>, (*71)

Return: - int, (*72)


chr_to_hex(int|string $char, string $prefix): string

↑ Get hexadecimal code point (U+xxxx) of a UTF-8 encoded character., (*73)

EXAMPLE: UTF8::chr_to_hex('§'); // U+00a7, (*74)

Parameters: - int|string $char <p>The input character</p> - string $prefix [optional], (*75)

Return: - string <p>The code point encoded as U+xxxx.</p>, (*76)


chunk_split(string $str, int $chunk_length, string $end): string

↑ Splits a string into smaller chunks and multiple lines, using the specified line ending character., (*77)

EXAMPLE: UTF8::chunk_split('ABC-ÖÄÜ-中文空白-κόσμε', 3); // "ABC\r\n-ÖÄ\r\nÜ-中\r\n文空白\r\n-κό\r\nσμε", (*78)

Parameters: - T $str <p>The original string to be split.</p> - int<1, max> $chunk_length [optional] <p>The maximum character length of a chunk.</p> - string $end [optional] <p>The character(s) to be inserted at the end of each chunk.</p>, (*79)

Return: - string <p>The chunked string.</p>, (*80)


clean(string $str, bool $remove_bom, bool $normalize_whitespace, bool $normalize_msword, bool $keep_non_breaking_space, bool $replace_diamond_question_mark, bool $remove_invisible_characters, bool $remove_invisible_characters_url_encoded): string

↑ Accepts a string and removes all non-UTF-8 characters from it + extras if needed., (*81)

EXAMPLE: UTF8::clean("\xEF\xBB\xBF„Abcdef\xc2\xa0\x20…” — 😃 - Düsseldorf", true, true); // '„Abcdef  …” — 😃 - Düsseldorf', (*82)

Parameters: - string $str <p>The string to be sanitized.</p> - bool $remove_bom [optional] <p>Set to true, if you need to remove UTF-BOM.</p> - bool $normalize_whitespace [optional] <p>Set to true, if you need to normalize the whitespace.</p> - bool $normalize_msword [optional] <p>Set to true, if you need to normalize MS Word chars e.g.: "…" => "..."</p> - bool $keep_non_breaking_space [optional] <p>Set to true, to keep non-breaking-spaces, in combination with $normalize_whitespace</p> - bool $replace_diamond_question_mark [optional] <p>Set to true, if you need to remove diamond question mark e.g.: "�"</p> - bool $remove_invisible_characters [optional] <p>Set to false, if you not want to remove invisible characters e.g.: "\0"</p> - bool $remove_invisible_characters_url_encoded [optional] <p>Set to true, if you not want to remove invisible url encoded characters e.g.: "%0B"<br> WARNING: maybe contains false-positives e.g. aa%0Baa -> aaaa. </p>, (*83)

Return: - string <p>An clean UTF-8 encoded string.</p>, (*84)


cleanup(string $str): string

↑ Clean-up a string and show only printable UTF-8 chars at the end + fix UTF-8 encoding., (*85)

EXAMPLE: UTF8::cleanup("\xEF\xBB\xBF„Abcdef\xc2\xa0\x20…” — 😃 - Düsseldorf", true, true); // '„Abcdef  …” — 😃 - Düsseldorf', (*86)

Parameters: - string $str <p>The input string.</p>, (*87)

Return: - string, (*88)


codepoints(string|string[] $arg, bool $use_u_style): int[]|string[]

↑ Accepts a string or an array of chars and returns an array of Unicode code points., (*89)

INFO: opposite to UTF8::string(), (*90)

EXAMPLE: UTF8::codepoints('κÜù'); // array(954, 246, 241) // ... OR ... UTF8::codepoints('κÜù', true); // array('U+03ba', 'U+00f6', 'U+00f1') , (*91)

Parameters: - T $arg <p>A UTF-8 encoded string or an array of such chars.</p> - bool $use_u_style <p>If True, will return code points in U+xxxx format, default, code points will be returned as integers.</p>, (*92)

Return: - int[]|string[] <p> The array of code points:<br> int[] for $u_style === false<br> string[] for $u_style === true<br> </p>, (*93)


collapse_whitespace(string $str): string

↑ Trims the string and replaces consecutive whitespace characters with a single space. This includes tabs and newline characters, as well as multibyte whitespace such as the thin space and ideographic space., (*94)

Parameters: - string $str <p>The input string.</p>, (*95)

Return: - string <p>A string with trimmed $str and condensed whitespace.</p>, (*96)


count_chars(string $str, bool $clean_utf8, bool $try_to_use_mb_functions): int[]

↑ Returns count of characters used in a string., (*97)

EXAMPLE: UTF8::count_chars('ÎşaÎşbÎşc'); // array('Îş' => 3, 'a' => 1, 'b' => 1, 'c' => 1), (*98)

Parameters: - T $str <p>The input string.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use, (*99)

Return: - int[] <p>An associative array of Character as keys and their count as values.</p>, (*100)


css_identifier(string $str, string[] $filter, bool $strip_tags, bool $strtolower): string

↑ Create a valid CSS identifier for e.g. "class"- or "id"-attributes., (*101)

EXAMPLE: UTF8::css_identifier('123foo/bar!!!'); // _23foo-bar, (*102)

copy&past from https://github.com/drupal/core/blob/8.8.x/lib/Drupal/Component/Utility/Html.php#L95, (*103)

Parameters: - string $str <p>INFO: if no identifier is given e.g. " " or "", we will create a unique string automatically</p> - array<string, string> $filter - bool $strip_tags - bool $strtolower, (*104)

Return: - string, (*105)


css_stripe_media_queries(string $str): string

↑ Remove css media-queries., (*106)

Parameters: - string $str, (*107)

Return: - string, (*108)


ctype_loaded(): bool

↑ Checks whether ctype is available on the server., (*109)

Parameters: nothing, (*110)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*111)


decimal_to_chr(int|string $int): string

↑ Converts an int value into a UTF-8 character., (*112)

INFO: opposite to UTF8::string(), (*113)

EXAMPLE: UTF8::decimal_to_chr(931); // 'ÎŁ', (*114)

Parameters: - int|string $int, (*115)

Return: - string, (*116)


decode_mimeheader(string $str, string $encoding): false|string

↑ Decodes a MIME header field, (*117)

Parameters: - string $str - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*118)

Return: - false|string <p>A decoded MIME field on success, or false if an error occurs during the decoding.</p>, (*119)


emoji_decode(string $str, bool $use_reversible_string_mappings): string

↑ Decodes a string which was encoded by "UTF8::emoji_encode()"., (*120)

INFO: opposite to UTF8::emoji_encode(), (*121)

EXAMPLE: UTF8::emoji_decode('foo CHARACTER_OGRE', false); // 'foo 👹' // UTF8::emoji_decode('foo -_PORTABLE_UTF8-308095726-627590803-8FTU_ELBATROP-_', true); // 'foo 👹' , (*122)

Parameters: - string $str <p>The input string.</p> - bool $use_reversible_string_mappings [optional] <p> When <b>TRUE</b>, we se a reversible string mapping between "emoji_encode" and "emoji_decode".</p>, (*123)

Return: - string, (*124)


emoji_encode(string $str, bool $use_reversible_string_mappings): string

↑ Encode a string with emoji chars into a non-emoji string., (*125)

INFO: opposite to UTF8::emoji_decode(), (*126)

EXAMPLE: UTF8::emoji_encode('foo 👹', false)); // 'foo CHARACTER_OGRE' // UTF8::emoji_encode('foo 👹', true)); // 'foo -_PORTABLE_UTF8-308095726-627590803-8FTU_ELBATROP-_' , (*127)

Parameters: - string $str <p>The input string</p> - bool $use_reversible_string_mappings [optional] <p> when <b>TRUE</b>, we use a reversible string mapping between "emoji_encode" and "emoji_decode"</p>, (*128)

Return: - string, (*129)


emoji_from_country_code(string $country_code_iso_3166_1): string

↑ Convert any two-letter country code (ISO 3166-1) to the corresponding Emoji., (*130)

Parameters: - string $country_code_iso_3166_1 <p>e.g. DE</p>, (*131)

Return: - string <p>Emoji or empty string on error.</p>, (*132)


encode(string $to_encoding, string $str, bool $auto_detect_the_from_encoding, string $from_encoding): string

↑ Encode a string with a new charset-encoding., (*133)

INFO: This function will also try to fix broken / double encoding, so you can call this function also on a UTF-8 string and you don't mess up the string., (*134)

EXAMPLE: UTF8::encode('ISO-8859-1', '-ABC-中文空白-'); // '-ABC-????-' // UTF8::encode('UTF-8', '-ABC-中文空白-'); // '-ABC-中文空白-' // UTF8::encode('HTML', '-ABC-中文空白-'); // '-ABC-中文空白-' // UTF8::encode('BASE64', '-ABC-中文空白-'); // 'LUFCQy3kuK3mlofnqbrnmb0t' , (*135)

Parameters: - string $to_encoding <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.</p> - string $str <p>The input string</p> - bool $auto_detect_the_from_encoding [optional] <p>Force the new encoding (we try to fix broken / double encoding for UTF-8)<br> otherwise we auto-detect the current string-encoding</p> - string $from_encoding [optional] <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.<br> A empty string will trigger the autodetect anyway.</p>, (*136)

Return: - string, (*137)


encode_mimeheader(string $str, string $from_charset, string $to_charset, string $transfer_encoding, string $linefeed, int $indent): false|string

↑, (*138)

Parameters: - string $str - string $from_charset [optional] <p>Set the input charset.</p> - string $to_charset [optional] <p>Set the output charset.</p> - string $transfer_encoding [optional] <p>Set the transfer encoding.</p> - string $linefeed [optional] <p>Set the used linefeed.</p> - int<1, max> $indent [optional] <p>Set the max length indent.</p>, (*139)

Return: - false|string <p>An encoded MIME field on success, or false if an error occurs during the encoding.</p>, (*140)


extract_text(string $str, string $search, int|null $length, string $replacer_for_skipped_text, string $encoding): string

↑ Create an extract from a sentence, so if the search-string was found, it tries to center in the output., (*141)

Parameters: - string $str <p>The input string.</p> - string $search <p>The searched string.</p> - int|null $length [optional] <p>Default: null === text->length / 2</p> - string $replacer_for_skipped_text [optional] <p>Default: …</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*142)

Return: - string, (*143)


file_get_contents(string $filename, bool $use_include_path, resource|null $context, int|null $offset, int|null $max_length, int $timeout, bool $convert_to_utf8, string $from_encoding): false|string

↑ Reads entire file into a string., (*144)

EXAMPLE: UTF8::file_get_contents('utf16le.txt'); // ..., (*145)

WARNING: Do not use UTF-8 Option ($convert_to_utf8) for binary files (e.g.: images) !!!, (*146)

Parameters: - string $filename <p> Name of the file to read. </p> - bool $use_include_path [optional] <p> Prior to PHP 5, this parameter is called use_include_path and is a bool. As of PHP 5 the FILE_USE_INCLUDE_PATH can be used to trigger include path search. </p> - resource|null $context [optional] <p> A valid context resource created with stream_context_create. If you don't need to use a custom context, you can skip this parameter by &null;. </p> - int|null $offset [optional] <p> The offset where the reading starts. </p> - int<0, max>|null $max_length [optional] <p> Maximum length of data read. The default is to read until end of file is reached. </p> - int $timeout <p>The time in seconds for the timeout.</p> - bool $convert_to_utf8 <strong>WARNING!!!</strong> <p>Maybe you can't use this option for some files, because they used non default utf-8 chars. Binary files like images or pdf will not be converted.</p> - string $from_encoding [optional] <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.<br> A empty string will trigger the autodetect anyway.</p>, (*147)

Return: - false|string <p>The function returns the read data as string or <b>false</b> on failure.</p>, (*148)


file_has_bom(string $file_path): bool

↑ Checks if a file starts with BOM (Byte Order Mark) character., (*149)

EXAMPLE: UTF8::file_has_bom('utf8_with_bom.txt'); // true, (*150)

Parameters: - string $file_path <p>Path to a valid file.</p>, (*151)

Return: - bool <p><strong>true</strong> if the file has BOM at the start, <strong>false</strong> otherwise</p>, (*152)


filter(array|object|string $var, int $normalization_form, string $leading_combining): mixed

↑ Normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed., (*153)

EXAMPLE: UTF8::filter(array("\xE9", 'à', 'a')); // array('é', 'à', 'a'), (*154)

Parameters: - TFilter $var - int $normalization_form - string $leading_combining, (*155)

Return: - mixed, (*156)


filter_input(int $type, string $variable_name, int $filter, int|int[]|null $options): mixed

↑ "filter_input()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed., (*157)

Gets a specific external variable by name and optionally filters it., (*158)

EXAMPLE: // _GET['foo'] = 'bar'; UTF8::filter_input(INPUT_GET, 'foo', FILTER_UNSAFE_RAW)); // 'bar' , (*159)

Parameters: - int $type <p> One of <b>INPUT_GET</b>, <b>INPUT_POST</b>, <b>INPUT_COOKIE</b>, <b>INPUT_SERVER</b>, or <b>INPUT_ENV</b>. </p> - string $variable_name <p> Name of a variable to get. </p> - int $filter [optional] <p> The ID of the filter to apply. The manual page lists the available filters. </p> - int|int[]|null $options [optional] <p> Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array. </p>, (*160)

Return: - mixed <p> Value of the requested variable on success, <b>FALSE</b> if the filter fails, or <b>NULL</b> if the <i>variable_name</i> variable is not set. If the flag <b>FILTER_NULL_ON_FAILURE</b> is used, it returns <b>FALSE</b> if the variable is not set and <b>NULL</b> if the filter fails. </p>, (*161)


filter_input_array(int $type, array|null $definition, bool $add_empty): arraystring,mixed|false|null

↑ "filter_input_array()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed., (*162)

Gets external variables and optionally filters them., (*163)

EXAMPLE: // _GET['foo'] = 'bar'; UTF8::filter_input_array(INPUT_GET, array('foo' => 'FILTER_UNSAFE_RAW')); // array('bar') , (*164)

Parameters: - int $type <p> One of <b>INPUT_GET</b>, <b>INPUT_POST</b>, <b>INPUT_COOKIE</b>, <b>INPUT_SERVER</b>, or <b>INPUT_ENV</b>. </p> - array<string, mixed>|null $definition [optional] <p> An array defining the arguments. A valid key is a string containing a variable name and a valid value is either a filter type, or an array optionally specifying the filter, flags and options. If the value is an array, valid keys are filter which specifies the filter type, flags which specifies any flags that apply to the filter, and options which specifies any options that apply to the filter. See the example below for a better understanding. </p> <p> This parameter can be also an integer holding a filter constant. Then all values in the input array are filtered by this filter. </p> - bool $add_empty [optional] <p> Add missing keys as <b>NULL</b> to the return value. </p>, (*165)

Return: - array<string,mixed>|false|null <p> An array containing the values of the requested variables on success, or <b>FALSE</b> on failure. An array value will be <b>FALSE</b> if the filter fails, or <b>NULL</b> if the variable is not set. Or if the flag <b>FILTER_NULL_ON_FAILURE</b> is used, it returns <b>FALSE</b> if the variable is not set and <b>NULL</b> if the filter fails. </p>, (*166)


filter_var(float|int|string|null $variable, int $filter, int|int[] $options): mixed

↑ "filter_var()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed., (*167)

Filters a variable with a specified filter., (*168)

EXAMPLE: UTF8::filter_var('-ABC-中文空白-', FILTER_VALIDATE_URL); // false, (*169)

Parameters: - float|int|string|null $variable <p> Value to filter. </p> - int $filter [optional] <p> The ID of the filter to apply. The manual page lists the available filters. </p> - int|int[] $options [optional] <p> Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array. For the "callback" filter, callable type should be passed. The callback must accept one argument, the value to be filtered, and return the value after filtering/sanitizing it. </p> <p> <code> // for filters that accept options, use this format $options = array( 'options' => array( 'default' => 3, // value to return if the filter fails // other options here 'min_range' => 0 ), 'flags' => FILTER_FLAG_ALLOW_OCTAL, ); $var = filter_var('0755', FILTER_VALIDATE_INT, $options); // for filter that only accept flags, you can pass them directly $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // for filter that only accept flags, you can also pass as an array $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, array('flags' => FILTER_NULL_ON_FAILURE)); // callback validate filter function foo($value) { // Expected format: Surname, GivenNames if (strpos($value, ", ") === false) return false; list($surname, $givennames) = explode(", ", $value, 2); $empty = (empty($surname) || empty($givennames)); $notstrings = (!is_string($surname) || !is_string($givennames)); if ($empty || $notstrings) { return false; } else { return $value; } } $var = filter_var('Doe, Jane Sue', FILTER_CALLBACK, array('options' => 'foo')); </code> </p>, (*170)

Return: - mixed <p>The filtered data, or <b>FALSE</b> if the filter fails.</p>, (*171)


filter_var_array(array $data, array|int $definition, bool $add_empty): arraystring,mixed|false|null

↑ "filter_var_array()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed., (*172)

Gets multiple variables and optionally filters them., (*173)

EXAMPLE: $filters = [ 'name' => ['filter' => FILTER_CALLBACK, 'options' => [UTF8::class, 'ucwords']], 'age' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1, 'max_range' => 120]], 'email' => FILTER_VALIDATE_EMAIL, ];, (*174)

$data = [ 'name' => 'κ὚σΟξ', 'age' => '18', 'email' => 'foo@bar.de' ];, (*175)

UTF8::filter_var_array($data, $filters, true); // ['name' => 'Κόσμε', 'age' => 18, 'email' => 'foo@bar.de'] , (*176)

Parameters: - array<string, mixed> $data <p> An array with string keys containing the data to filter. </p> - array<string, mixed>|int $definition [optional] <p> An array defining the arguments. A valid key is a string containing a variable name and a valid value is either a filter type, or an array optionally specifying the filter, flags and options. If the value is an array, valid keys are filter which specifies the filter type, flags which specifies any flags that apply to the filter, and options which specifies any options that apply to the filter. See the example below for a better understanding. </p> <p> This parameter can be also an integer holding a filter constant. Then all values in the input array are filtered by this filter. </p> - bool $add_empty [optional] <p> Add missing keys as <b>NULL</b> to the return value. </p>, (*177)

Return: - array<string,mixed>|false|null <p> An array containing the values of the requested variables on success, or <b>FALSE</b> on failure. An array value will be <b>FALSE</b> if the filter fails, or <b>NULL</b> if the variable is not set. </p>, (*178)


finfo_loaded(): bool

↑ Checks whether finfo is available on the server., (*179)

Parameters: nothing, (*180)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*181)


first_char(string $str, int $n, string $encoding): string

↑ Returns the first $n characters of the string., (*182)

Parameters: - T $str <p>The input string.</p> - int<1, max> $n <p>Number of characters to retrieve from the start.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*183)

Return: - string, (*184)


fits_inside(string $str, int $box_size): bool

↑ Check if the number of Unicode characters isn't greater than the specified integer., (*185)

EXAMPLE: UTF8::fits_inside('κ὚σΟξ', 6); // false, (*186)

Parameters: - string $str the original string to be checked - int $box_size the size in number of chars to be checked against string, (*187)

Return: - bool <p><strong>TRUE</strong> if string is less than or equal to $box_size, <strong>FALSE</strong> otherwise.</p>, (*188)


fix_simple_utf8(string $str): string

↑ Try to fix simple broken UTF-8 strings., (*189)

INFO: Take a look at "UTF8::fix_utf8()" if you need a more advanced fix for broken UTF-8 strings., (*190)

EXAMPLE: UTF8::fix_simple_utf8('Dßsseldorf'); // 'Dßsseldorf', (*191)

If you received an UTF-8 string that was converted from Windows-1252 as it was ISO-8859-1 (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it. See: http://en.wikipedia.org/wiki/Windows-1252, (*192)

Parameters: - string $str <p>The input string</p>, (*193)

Return: - string, (*194)


fix_utf8(string|string[] $str): string|string[]

↑ Fix a double (or multiple) encoded UTF8 string., (*195)

EXAMPLE: UTF8::fix_utf8('Fédération'); // 'Fédération', (*196)

Parameters: - TFixUtf8 $str you can use a string or an array of strings, (*197)

Return: - string|string[] <p>Will return the fixed input-"array" or the fixed input-"string".</p>, (*198)


getCharDirection(string $char): string

↑ Get character of a specific character., (*199)

EXAMPLE: UTF8::getCharDirection('ا'); // 'RTL', (*200)

Parameters: - string $char, (*201)

Return: - string <p>'RTL' or 'LTR'.</p>, (*202)


getSupportInfo(string|null $key): mixed

↑ Check for php-support., (*203)

Parameters: - string|null $key, (*204)

Return: - mixed Return the full support-"array", if $key === null<br> return bool-value, if $key is used and available<br> otherwise return <strong>null</strong>, (*205)


getUrlParamFromArray(string $param, array $data): mixed

↑ Get data from an array via array like string., (*206)

EXAMPLE: $array['foo'][123] = 'lall'; UTF8::getUrlParamFromArray('foo[123]', $array); // 'lall', (*207)

Parameters: - string $param - array<array-key, mixed> $data, (*208)

Return: - mixed, (*209)


get_file_type(string $str, array $fallback):

↑ Warning: this method only works for some file-types (png, jpg) if you need more supported types, please use e.g. "finfo", (*210)

Parameters: - string $str - array{ext: (null|string), mime: (null|string), type: (null|string)} $fallback, (*211)

Return: - array{ext: (null|string), mime: (null|string), type: (null|string)}, (*212)


get_random_string(int $length, string $possible_chars, string $encoding): string

↑, (*213)

Parameters: - int<1, max> $length <p>Length of the random string.</p> - T $possible_chars [optional] <p>Characters string for the random selection.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*214)

Return: - string, (*215)


get_unique_string(int|string $extra_entropy, bool $use_md5): non-empty-string

↑, (*216)

Parameters: - int|string $extra_entropy [optional] <p>Extra entropy via a string or int value.</p> - bool $use_md5 [optional] <p>Return the unique identifier as md5-hash? Default: true</p>, (*217)

Return: - non-empty-string, (*218)


has_lowercase(string $str): bool

↑ Returns true if the string contains a lower case char, false otherwise., (*219)

Parameters: - string $str <p>The input string.</p>, (*220)

Return: - bool <p>Whether or not the string contains a lower case character.</p>, (*221)


has_uppercase(string $str): bool

↑ Returns true if the string contains an upper case char, false otherwise., (*222)

Parameters: - string $str <p>The input string.</p>, (*223)

Return: - bool <p>Whether or not the string contains an upper case character.</p>, (*224)


has_whitespace(string $str): bool

↑ Returns true if the string contains whitespace, false otherwise., (*225)

Parameters: - string $str <p>The input string.</p>, (*226)

Return: - bool <p>Whether or not the string contains whitespace.</p>, (*227)


hex_to_chr(string $hexdec): string

↑ Converts a hexadecimal value into a UTF-8 character., (*228)

INFO: opposite to UTF8::chr_to_hex(), (*229)

EXAMPLE: UTF8::hex_to_chr('U+00a7'); // '§', (*230)

Parameters: - string $hexdec <p>The hexadecimal value.</p>, (*231)

Return: - string <p>One single UTF-8 character.</p>, (*232)


hex_to_int(string $hexdec): false|int

↑ Converts hexadecimal U+xxxx code point representation to integer., (*233)

INFO: opposite to UTF8::int_to_hex(), (*234)

EXAMPLE: UTF8::hex_to_int('U+00f1'); // 241, (*235)

Parameters: - string $hexdec <p>The hexadecimal code point representation.</p>, (*236)

Return: - false|int <p>The code point, or false on failure.</p>, (*237)


html_encode(string $str, bool $keep_ascii_chars, string $encoding): string

↑ Converts a UTF-8 string to a series of HTML numbered entities., (*238)

INFO: opposite to UTF8::html_decode(), (*239)

EXAMPLE: UTF8::html_encode('中文空白'); // '中文空白', (*240)

Parameters: - T $str <p>The Unicode string to be encoded as numbered entities.</p> - bool $keep_ascii_chars [optional] <p>Keep ASCII chars.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*241)

Return: - string <p>HTML numbered entities.</p>, (*242)


html_entity_decode(string $str, int|null $flags, string $encoding): string

↑ UTF-8 version of html_entity_decode(), (*243)

The reason we are not using html_entity_decode() by itself is because while it is not technically correct to leave out the semicolon at the end of an entity most browsers will still interpret the entity correctly. html_entity_decode() does not convert entities without semicolons, so we are left with our own little solution here. Bummer., (*244)

Convert all HTML entities to their applicable characters., (*245)

INFO: opposite to UTF8::html_encode(), (*246)

EXAMPLE: UTF8::html_entity_decode('中文空白'); // '中文空白', (*247)

Parameters: - T $str <p> The input string. </p> - int|null $flags [optional] <p> A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is ENT_COMPAT | ENT_HTML401. <table> Available <i>flags</i> constants <tr valign="top"> <td>Constant Name</td> <td>Description</td> </tr> <tr valign="top"> <td><b>ENT_COMPAT</b></td> <td>Will convert double-quotes and leave single-quotes alone.</td> </tr> <tr valign="top"> <td><b>ENT_QUOTES</b></td> <td>Will convert both double and single quotes.</td> </tr> <tr valign="top"> <td><b>ENT_NOQUOTES</b></td> <td>Will leave both double and single quotes unconverted.</td> </tr> <tr valign="top"> <td><b>ENT_HTML401</b></td> <td> Handle code as HTML 4.01. </td> </tr> <tr valign="top"> <td><b>ENT_XML1</b></td> <td> Handle code as XML 1. </td> </tr> <tr valign="top"> <td><b>ENT_XHTML</b></td> <td> Handle code as XHTML. </td> </tr> <tr valign="top"> <td><b>ENT_HTML5</b></td> <td> Handle code as HTML 5. </td> </tr> </table> </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*248)

Return: - string <p>The decoded string.</p>, (*249)


html_escape(string $str, string $encoding): string

↑ Create a escape html version of the string via "UTF8::htmlspecialchars()"., (*250)

Parameters: - string $str - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*251)

Return: - string, (*252)


html_stripe_empty_tags(string $str): string

↑ Remove empty html-tag., (*253)

e.g.:, (*254)

Parameters: - string $str, (*255)

Return: - string, (*256)


htmlentities(string $str, int $flags, string $encoding, bool $double_encode): string

↑ Convert all applicable characters to HTML entities: UTF-8 version of htmlentities()., (*257)

EXAMPLE: UTF8::htmlentities('白-öäü'); // '<白-öäü>', (*258)

Parameters: - string $str <p> The input string. </p> - int $flags [optional] <p> A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT | ENT_HTML401. <table> Available <i>flags</i> constants <tr valign="top"> <td>Constant Name</td> <td>Description</td> </tr> <tr valign="top"> <td><b>ENT_COMPAT</b></td> <td>Will convert double-quotes and leave single-quotes alone.</td> </tr> <tr valign="top"> <td><b>ENT_QUOTES</b></td> <td>Will convert both double and single quotes.</td> </tr> <tr valign="top"> <td><b>ENT_NOQUOTES</b></td> <td>Will leave both double and single quotes unconverted.</td> </tr> <tr valign="top"> <td><b>ENT_IGNORE</b></td> <td> Silently discard invalid code unit sequences instead of returning an empty string. Using this flag is discouraged as it may have security implications. </td> </tr> <tr valign="top"> <td><b>ENT_SUBSTITUTE</b></td> <td> Replace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or &#38;#38;#FFFD; (otherwise) instead of returning an empty string. </td> </tr> <tr valign="top"> <td><b>ENT_DISALLOWED</b></td> <td> Replace invalid code points for the given document type with a Unicode Replacement Character U+FFFD (UTF-8) or &#38;#38;#FFFD; (otherwise) instead of leaving them as is. This may be useful, for instance, to ensure the well-formedness of XML documents with embedded external content. </td> </tr> <tr valign="top"> <td><b>ENT_HTML401</b></td> <td> Handle code as HTML 4.01. </td> </tr> <tr valign="top"> <td><b>ENT_XML1</b></td> <td> Handle code as XML 1. </td> </tr> <tr valign="top"> <td><b>ENT_XHTML</b></td> <td> Handle code as XHTML. </td> </tr> <tr valign="top"> <td><b>ENT_HTML5</b></td> <td> Handle code as HTML 5. </td> </tr> </table> </p> - string $encoding [optional] <p> Like <b>htmlspecialchars</b>, <b>htmlentities</b> takes an optional third argument <i>encoding</i> which defines encoding used in conversion. Although this argument is technically optional, you are highly encouraged to specify the correct value for your code. </p> - bool $double_encode [optional] <p> When <i>double_encode</i> is turned off PHP will not encode existing html entities. The default is to convert everything. </p>, (*259)

Return: - string <p> The encoded string. <br><br> If the input <i>string</i> contains an invalid code unit sequence within the given <i>encoding</i> an empty string will be returned, unless either the <b>ENT_IGNORE</b> or <b>ENT_SUBSTITUTE</b> flags are set. </p>, (*260)


htmlspecialchars(string $str, int $flags, string $encoding, bool $double_encode): string

↑ Convert only special characters to HTML entities: UTF-8 version of htmlspecialchars(), (*261)

INFO: Take a look at "UTF8::htmlentities()", (*262)

EXAMPLE: UTF8::htmlspecialchars('白-öäü'); // '<白-öäü>', (*263)

Parameters: - T $str <p> The string being converted. </p> - int $flags [optional] <p> A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT | ENT_HTML401. <table> Available <i>flags</i> constants <tr valign="top"> <td>Constant Name</td> <td>Description</td> </tr> <tr valign="top"> <td><b>ENT_COMPAT</b></td> <td>Will convert double-quotes and leave single-quotes alone.</td> </tr> <tr valign="top"> <td><b>ENT_QUOTES</b></td> <td>Will convert both double and single quotes.</td> </tr> <tr valign="top"> <td><b>ENT_NOQUOTES</b></td> <td>Will leave both double and single quotes unconverted.</td> </tr> <tr valign="top"> <td><b>ENT_IGNORE</b></td> <td> Silently discard invalid code unit sequences instead of returning an empty string. Using this flag is discouraged as it may have security implications. </td> </tr> <tr valign="top"> <td><b>ENT_SUBSTITUTE</b></td> <td> Replace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or &#38;#38;#FFFD; (otherwise) instead of returning an empty string. </td> </tr> <tr valign="top"> <td><b>ENT_DISALLOWED</b></td> <td> Replace invalid code points for the given document type with a Unicode Replacement Character U+FFFD (UTF-8) or &#38;#38;#FFFD; (otherwise) instead of leaving them as is. This may be useful, for instance, to ensure the well-formedness of XML documents with embedded external content. </td> </tr> <tr valign="top"> <td><b>ENT_HTML401</b></td> <td> Handle code as HTML 4.01. </td> </tr> <tr valign="top"> <td><b>ENT_XML1</b></td> <td> Handle code as XML 1. </td> </tr> <tr valign="top"> <td><b>ENT_XHTML</b></td> <td> Handle code as XHTML. </td> </tr> <tr valign="top"> <td><b>ENT_HTML5</b></td> <td> Handle code as HTML 5. </td> </tr> </table> </p> - string $encoding [optional] <p> Defines encoding used in conversion. </p> <p> For the purposes of this function, the encodings ISO-8859-1, ISO-8859-15, UTF-8, cp866, cp1251, cp1252, and KOI8-R are effectively equivalent, provided the <i>string</i> itself is valid for the encoding, as the characters affected by <b>htmlspecialchars</b> occupy the same positions in all of these encodings. </p> - bool $double_encode [optional] <p> When <i>double_encode</i> is turned off PHP will not encode existing html entities, the default is to convert everything. </p>, (*264)

Return: - string <p>The converted string.</p> <p> If the input <i>string</i> contains an invalid code unit sequence within the given <i>encoding</i> an empty string will be returned, unless either the <b>ENT_IGNORE</b> or <b>ENT_SUBSTITUTE</b> flags are set.</p>, (*265)


iconv_loaded(): bool

↑ Checks whether iconv is available on the server., (*266)

Parameters: nothing, (*267)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*268)


int_to_hex(int $int, string $prefix): string

↑ Converts Integer to hexadecimal U+xxxx code point representation., (*269)

INFO: opposite to UTF8::hex_to_int(), (*270)

EXAMPLE: UTF8::int_to_hex(241); // 'U+00f1', (*271)

Parameters: - int $int <p>The integer to be converted to hexadecimal code point.</p> - string $prefix [optional], (*272)

Return: - string the code point, or empty string on failure, (*273)


intlChar_loaded(): bool

↑ Checks whether intl-char is available on the server., (*274)

Parameters: nothing, (*275)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*276)


intl_loaded(): bool

↑ Checks whether intl is available on the server., (*277)

Parameters: nothing, (*278)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*279)


is_alpha(string $str): bool

↑ Returns true if the string contains only alphabetic chars, false otherwise., (*280)

Parameters: - string $str <p>The input string.</p>, (*281)

Return: - bool <p>Whether or not $str contains only alphabetic chars.</p>, (*282)


is_alphanumeric(string $str): bool

↑ Returns true if the string contains only alphabetic and numeric chars, false otherwise., (*283)

Parameters: - string $str <p>The input string.</p>, (*284)

Return: - bool <p>Whether or not $str contains only alphanumeric chars.</p>, (*285)


is_ascii(string $str): bool

↑ Checks if a string is 7 bit ASCII., (*286)

EXAMPLE: UTF8::is_ascii('白'); // false, (*287)

Parameters: - string $str <p>The string to check.</p>, (*288)

Return: - bool <p> <strong>true</strong> if it is ASCII<br> <strong>false</strong> otherwise </p>, (*289)


is_base64(string|null $str, bool $empty_string_is_valid): bool

↑ Returns true if the string is base64 encoded, false otherwise., (*290)

EXAMPLE: UTF8::is_base64('4KSu4KWL4KSo4KS/4KSa'); // true, (*291)

Parameters: - string|null $str <p>The input string.</p> - bool $empty_string_is_valid [optional] <p>Is an empty string valid base64 or not?</p>, (*292)

Return: - bool <p>Whether or not $str is base64 encoded.</p>, (*293)


is_binary(int|string $input, bool $strict): bool

↑ Check if the input is binary... (is look like a hack)., (*294)

EXAMPLE: UTF8::is_binary(01); // true, (*295)

Parameters: - int|string $input - bool $strict, (*296)

Return: - bool, (*297)


is_binary_file(string $file): bool

↑ Check if the file is binary., (*298)

EXAMPLE: UTF8::is_binary('./utf32.txt'); // true, (*299)

Parameters: - string $file, (*300)

Return: - bool, (*301)


is_blank(string $str): bool

↑ Returns true if the string contains only whitespace chars, false otherwise., (*302)

Parameters: - string $str <p>The input string.</p>, (*303)

Return: - bool <p>Whether or not $str contains only whitespace characters.</p>, (*304)


is_bom(string $str): bool

↑ Checks if the given string is equal to any "Byte Order Mark"., (*305)

WARNING: Use "UTF8::string_has_bom()" if you will check BOM in a string., (*306)

EXAMPLE: UTF8::is_bom("\xef\xbb\xbf"); // true, (*307)

Parameters: - string $str <p>The input string.</p>, (*308)

Return: - bool <p><strong>true</strong> if the $utf8_chr is Byte Order Mark, <strong>false</strong> otherwise.</p>, (*309)


is_empty(array|float|int|string $str): bool

↑ Determine whether the string is considered to be empty., (*310)

A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist., (*311)

Parameters: - array<array-key, mixed>|float|int|string $str, (*312)

Return: - bool <p>Whether or not $str is empty().</p>, (*313)


is_hexadecimal(string $str): bool

↑ Returns true if the string contains only hexadecimal chars, false otherwise., (*314)

Parameters: - string $str <p>The input string.</p>, (*315)

Return: - bool <p>Whether or not $str contains only hexadecimal chars.</p>, (*316)


is_html(string $str): bool

↑ Check if the string contains any HTML tags., (*317)

EXAMPLE: UTF8::is_html('lall'); // true, (*318)

Parameters: - string $str <p>The input string.</p>, (*319)

Return: - bool <p>Whether or not $str contains html elements.</p>, (*320)


is_json(string $str, bool $only_array_or_object_results_are_valid): bool

↑ Try to check if "$str" is a JSON-string., (*321)

EXAMPLE: UTF8::is_json('{"array":[1,"¼","ä"]}'); // true, (*322)

Parameters: - string $str <p>The input string.</p> - bool $only_array_or_object_results_are_valid [optional] <p>Only array and objects are valid json results.</p>, (*323)

Return: - bool <p>Whether or not the $str is in JSON format.</p>, (*324)


is_lowercase(string $str): bool

↑, (*325)

Parameters: - string $str <p>The input string.</p>, (*326)

Return: - bool <p>Whether or not $str contains only lowercase chars.</p>, (*327)


is_printable(string $str, bool $ignore_control_characters): bool

↑ Returns true if the string contains only printable (non-invisible) chars, false otherwise., (*328)

Parameters: - string $str <p>The input string.</p> - bool $ignore_control_characters [optional] <p>Ignore control characters like [LRM] or [LSEP].</p>, (*329)

Return: - bool <p>Whether or not $str contains only printable (non-invisible) chars.</p>, (*330)


is_punctuation(string $str): bool

↑ Returns true if the string contains only punctuation chars, false otherwise., (*331)

Parameters: - string $str <p>The input string.</p>, (*332)

Return: - bool <p>Whether or not $str contains only punctuation chars.</p>, (*333)


is_serialized(string $str): bool

↑ Returns true if the string is serialized, false otherwise., (*334)

Parameters: - string $str <p>The input string.</p>, (*335)

Return: - bool <p>Whether or not $str is serialized.</p>, (*336)


is_uppercase(string $str): bool

↑ Returns true if the string contains only lower case chars, false otherwise., (*337)

Parameters: - string $str <p>The input string.</p>, (*338)

Return: - bool <p>Whether or not $str contains only lower case characters.</p>, (*339)


is_url(string $url, bool $disallow_localhost): bool

↑ Check if $url is an correct url., (*340)

Parameters: - string $url - bool $disallow_localhost, (*341)

Return: - bool, (*342)


is_utf8(int|string|string[]|null $str, bool $strict): bool

↑ Checks whether the passed input contains only byte sequences that appear valid UTF-8., (*343)

EXAMPLE: UTF8::is_utf8(['IùtÍrnâtiônàlizÌtiøn', 'foo']); // true // UTF8::is_utf8(["IùtÍrnâtiônàlizÌtiøn\xA0\xA1", 'bar']); // false , (*344)

Parameters: - int|string|string[]|null $str <p>The input to be checked.</p> - bool $strict <p>Check also if the string is not UTF-16 or UTF-32.</p>, (*345)

Return: - bool, (*346)


is_utf16(string $str, bool $check_if_string_is_binary): false|int

↑ Check if the string is UTF-16., (*347)

EXAMPLE: UTF8::is_utf16(file_get_contents('utf-16-le.txt')); // 1 // UTF8::is_utf16(file_get_contents('utf-16-be.txt')); // 2 // UTF8::is_utf16(file_get_contents('utf-8.txt')); // false , (*348)

Parameters: - string $str <p>The input string.</p> - bool $check_if_string_is_binary, (*349)

Return: - false|int <strong>false</strong> if is't not UTF-16,<br> <strong>1</strong> for UTF-16LE,<br> <strong>2</strong> for UTF-16BE, (*350)


is_utf32(string $str, bool $check_if_string_is_binary): false|int

↑ Check if the string is UTF-32., (*351)

EXAMPLE: UTF8::is_utf32(file_get_contents('utf-32-le.txt')); // 1 // UTF8::is_utf32(file_get_contents('utf-32-be.txt')); // 2 // UTF8::is_utf32(file_get_contents('utf-8.txt')); // false , (*352)

Parameters: - string $str <p>The input string.</p> - bool $check_if_string_is_binary, (*353)

Return: - false|int <strong>false</strong> if is't not UTF-32,<br> <strong>1</strong> for UTF-32LE,<br> <strong>2</strong> for UTF-32BE, (*354)


json_decode(string $json, bool $assoc, int $depth, int $options): mixed

↑ (PHP 5 >= 5.2.0, PECL json >= 1.2.0)br/ Decodes a JSON string, (*355)

EXAMPLE: UTF8::json_decode('[1,"\u00a5","\u00e4"]'); // array(1, '¼', 'ä'), (*356)

Parameters: - string $json <p> The <i>json</i> string being decoded. </p> <p> This function only works with UTF-8 encoded strings. </p> <p>PHP implements a superset of JSON - it will also encode and decode scalar types and <b>NULL</b>. The JSON standard only supports these values when they are nested inside an array or an object. </p> - bool $assoc [optional] <p> When <b>TRUE</b>, returned objects will be converted into associative arrays. </p> - int $depth [optional] <p> User specified recursion depth. </p> - int $options [optional] <p> Bitmask of JSON decode options. Currently only <b>JSON_BIGINT_AS_STRING</b> is supported (default is to cast large integers as floats) </p>, (*357)

Return: - mixed <p>The value encoded in <i>json</i> in appropriate PHP type. Values true, false and null (case-insensitive) are returned as <b>TRUE</b>, <b>FALSE</b> and <b>NULL</b> respectively. <b>NULL</b> is returned if the <i>json</i> cannot be decoded or if the encoded data is deeper than the recursion limit.</p>, (*358)


json_encode(mixed $value, int $options, int $depth): false|string

↑ (PHP 5 >= 5.2.0, PECL json >= 1.2.0)br/ Returns the JSON representation of a value., (*359)

EXAMPLE: UTF8::json_encode(array(1, '¼', 'ä')); // '[1,"\u00a5","\u00e4"]', (*360)

Parameters: - mixed $value <p> The <i>value</i> being encoded. Can be any type except a resource. </p> <p> All string data must be UTF-8 encoded. </p> <p>PHP implements a superset of JSON - it will also encode and decode scalar types and <b>NULL</b>. The JSON standard only supports these values when they are nested inside an array or an object. </p> - int $options [optional] <p> Bitmask consisting of <b>JSON_HEX_QUOT</b>, <b>JSON_HEX_TAG</b>, <b>JSON_HEX_AMP</b>, <b>JSON_HEX_APOS</b>, <b>JSON_NUMERIC_CHECK</b>, <b>JSON_PRETTY_PRINT</b>, <b>JSON_UNESCAPED_SLASHES</b>, <b>JSON_FORCE_OBJECT</b>, <b>JSON_UNESCAPED_UNICODE</b>. The behaviour of these constants is described on the JSON constants page. </p> - int $depth [optional] <p> Set the maximum depth. Must be greater than zero. </p>, (*361)

Return: - false|string <p>A JSON encoded <strong>string</strong> on success or<br> <strong>FALSE</strong> on failure.</p>, (*362)


json_loaded(): bool

↑ Checks whether JSON is available on the server., (*363)

Parameters: nothing, (*364)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*365)


lcfirst(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Makes string's first char lowercase., (*366)

EXAMPLE: UTF8::lcfirst('ÑTËRNÂTIÔNÀLIZÆTIØN'); // ñTËRNÂTIÔNÀLIZÆTIØN, (*367)

Parameters: - string $str <p>The input string</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*368)

Return: - string <p>The resulting string.</p>, (*369)


lcwords(string $str, string[] $exceptions, string $char_list, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Lowercase for all words in the string., (*370)

Parameters: - string $str <p>The input string.</p> - string[] $exceptions [optional] <p>Exclusion for some words.</p> - string $char_list [optional] <p>Additional chars that contains to words and do not start a new word.</p> - string $encoding [optional] <p>Set the charset.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*371)

Return: - string, (*372)


levenshtein(string $str1, string $str2, int $insertionCost, int $replacementCost, int $deletionCost): int

↑ Calculate Levenshtein distance between two strings., (*373)

For better performance, in a real application with a single input string matched against many strings from a database, you will probably want to pre- encode the input only once and use \levenshtein()., (*374)

Source: https://github.com/KEINOS/mb_levenshtein, (*375)

Parameters: - string $str1 <p>One of the strings being evaluated for Levenshtein distance.</p> - string $str2 <p>One of the strings being evaluated for Levenshtein distance.</p> - int $insertionCost [optional] <p>Defines the cost of insertion.</p> - int $replacementCost [optional] <p>Defines the cost of replacement.</p> - int $deletionCost [optional] <p>Defines the cost of deletion.</p>, (*376)

Return: - int, (*377)


ltrim(string $str, string|null $chars): string

↑ Strip whitespace or other characters from the beginning of a UTF-8 string., (*378)

EXAMPLE: UTF8::ltrim(' 中文空白  '); // '中文空白  ', (*379)

Parameters: - string $str <p>The string to be trimmed</p> - string|null $chars <p>Optional characters to be stripped</p>, (*380)

Return: - string the string with unwanted characters stripped from the left, (*381)


max(string|string[] $arg): string|null

↑ Returns the UTF-8 character with the maximum code point in the given data., (*382)

EXAMPLE: UTF8::max('abc-äöü-中文空白'); // 'ø', (*383)

Parameters: - string|string[] $arg <p>A UTF-8 encoded string or an array of such strings.</p>, (*384)

Return: - string|null the character with the highest code point than others, returns null on failure or empty input, (*385)


max_chr_width(string $str): int

↑ Calculates and returns the maximum number of bytes taken by any UTF-8 encoded character in the given string., (*386)

EXAMPLE: UTF8::max_chr_width('IntÍrnâtiônàlizÌtiøn'); // 2, (*387)

Parameters: - string $str <p>The original Unicode string.</p>, (*388)

Return: - int <p>Max byte lengths of the given chars.</p>, (*389)


mbstring_loaded(): bool

↑ Checks whether mbstring is available on the server., (*390)

Parameters: nothing, (*391)

Return: - bool <p><strong>true</strong> if available, <strong>false</strong> otherwise</p>, (*392)


min(string|string[] $arg): string|null

↑ Returns the UTF-8 character with the minimum code point in the given data., (*393)

EXAMPLE: UTF8::min('abc-äöü-中文空白'); // '-', (*394)

Parameters: - string|string[] $arg <strong>A UTF-8 encoded string or an array of such strings.</strong>, (*395)

Return: - string|null <p>The character with the lowest code point than others, returns null on failure or empty input.</p>, (*396)


normalize_encoding(mixed $encoding, mixed $fallback): mixed|string

↑ Normalize the encoding-"name" input., (*397)

EXAMPLE: UTF8::normalize_encoding('UTF8'); // 'UTF-8', (*398)

Parameters: - mixed $encoding <p>e.g.: ISO, UTF8, WINDOWS-1251 etc.</p> - string|TNormalizeEncodingFallback $fallback <p>e.g.: UTF-8</p>, (*399)

Return: - mixed|string <p>e.g.: ISO-8859-1, UTF-8, WINDOWS-1251 etc.<br>Will return a empty string as fallback (by default)</p>, (*400)


normalize_line_ending(string $str, string|string[] $replacer): string

↑ Standardize line ending to unix-like., (*401)

Parameters: - string $str <p>The input string.</p> - string|string[] $replacer <p>The replacer char e.g. "\n" (Linux) or "\r\n" (Windows). You can also use \PHP_EOL here.</p>, (*402)

Return: - string <p>A string with normalized line ending.</p>, (*403)


normalize_msword(string $str): string

↑ Normalize some MS Word special characters., (*404)

EXAMPLE: UTF8::normalize_msword('„Abcdef…”'); // '"Abcdef..."', (*405)

Parameters: - string $str <p>The string to be normalized.</p>, (*406)

Return: - string <p>A string with normalized characters for commonly used chars in Word documents.</p>, (*407)


normalize_whitespace(string $str, bool $keep_non_breaking_space, bool $keep_bidi_unicode_controls, bool $normalize_control_characters): string

↑ Normalize the whitespace., (*408)

EXAMPLE: UTF8::normalize_whitespace("abc-\xc2\xa0-Üäß-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-Üäß- -", (*409)

Parameters: - string $str <p>The string to be normalized.</p> - bool $keep_non_breaking_space [optional] <p>Set to true, to keep non-breaking-spaces.</p> - bool $keep_bidi_unicode_controls [optional] <p>Set to true, to keep non-printable (for the web) bidirectional text chars.</p> - bool $normalize_control_characters [optional] <p>Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p>, (*410)

Return: - string <p>A string with normalized whitespace.</p>, (*411)


ord(string $chr, string $encoding): int

↑ Calculates Unicode code point of the given UTF-8 encoded character., (*412)

INFO: opposite to UTF8::chr(), (*413)

EXAMPLE: UTF8::ord('☃'); // 0x2603, (*414)

Parameters: - string $chr <p>The character of which to calculate code point.<p/> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*415)

Return: - int <p>Unicode code point of the given character,<br> 0 on invalid UTF-8 byte sequence</p>, (*416)


parse_str(string $str, array $result, bool $clean_utf8): bool

↑ Parses the string into an array (into the the second parameter)., (*417)

WARNING: Unlike "parse_str()", this method does not (re-)place variables in the current scope, if the second parameter is not set!, (*418)

EXAMPLE: UTF8::parse_str('Iñtërnâtiônéàlizætiøn=測試&arr[]=foo+測試&arr[]=ການທົດສອບ', $array); echo $array['Iñtërnâtiônéàlizætiøn']; // '測試' , (*419)

Parameters: - string $str <p>The input string.</p> - array<string, mixed> $result <p>The result will be returned into this reference parameter.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*420)

Return: - bool <p>Will return <strong>false</strong> if php can't parse the string and we haven't any $result.</p>, (*421)


pcre_utf8_support(): bool

↑ Checks if \u modifier is available that enables Unicode support in PCRE., (*422)

Parameters: nothing, (*423)

Return: - bool <p> <strong>true</strong> if support is available,<br> <strong>false</strong> otherwise </p>, (*424)


range(int|string $var1, int|string $var2, bool $use_ctype, string $encoding, float|int $step): list

↑ Create an array containing a range of UTF-8 characters., (*425)

EXAMPLE: UTF8::range('κ', 'Μ'); // array('κ', 'Κ', 'θ', 'Ρ', 'Μ',), (*426)

Parameters: - int|string $var1 <p>Numeric or hexadecimal code points, or a UTF-8 character to start from.</p> - int|string $var2 <p>Numeric or hexadecimal code points, or a UTF-8 character to end at.</p> - bool $use_ctype <p>use ctype to detect numeric and hexadecimal, otherwise we will use a simple "is_numeric"</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - float|int $step [optional] <p> If a step value is given, it will be used as the increment between elements in the sequence. step should be given as a positive number. If not specified, step will default to 1. </p>, (*427)

Return: - list<string>, (*428)


rawurldecode(string $str, bool $multi_decode): string

↑ Multi decode HTML entity + fix urlencoded-win1252-chars., (*429)

EXAMPLE: UTF8::rawurldecode('tes%20Üäß%20\u00edtest+test'); // 'tes Üäß ítest+test', (*430)

e.g: 'test+test' => 'test+test' 'Dßsseldorf' => 'Dßsseldorf' 'D%FCsseldorf' => 'Dßsseldorf' 'Dßsseldorf' => 'Dßsseldorf' 'D%26%23xFC%3Bsseldorf' => 'Dßsseldorf' 'Dßsseldorf' => 'Dßsseldorf' 'D%C3%BCsseldorf' => 'Dßsseldorf' 'D%C3%83%C2%BCsseldorf' => 'Dßsseldorf' 'D%25C3%2583%25C2%25BCsseldorf' => 'Dßsseldorf', (*431)

Parameters: - T $str <p>The input string.</p> - bool $multi_decode <p>Decode as often as possible.</p>, (*432)

Return: - string <p>The decoded URL, as a string.</p>, (*433)


regex_replace(string $str, string $pattern, string $replacement, string $options, string $delimiter): string

↑ Replaces all occurrences of $pattern in $str by $replacement., (*434)

Parameters: - string $str <p>The input string.</p> - string $pattern <p>The regular expression pattern.</p> - string $replacement <p>The string to replace with.</p> - string $options [optional] <p>Matching conditions to be used.</p> - string $delimiter [optional] <p>Delimiter the the regex. Default: '/'</p>, (*435)

Return: - string, (*436)


remove_bom(string $str): string

↑ Remove the BOM from UTF-8 / UTF-16 / UTF-32 strings., (*437)

EXAMPLE: UTF8::remove_bom("\xEF\xBB\xBFΜπορώ να"); // 'Μπορώ να', (*438)

Parameters: - string $str <p>The input string.</p>, (*439)

Return: - string <p>A string without UTF-BOM.</p>, (*440)


remove_duplicates(string $str, string|string[] $what): string

↑ Removes duplicate occurrences of a string in another string., (*441)

EXAMPLE: UTF8::remove_duplicates('Üäß-κ὚σΟξκ὚σΟξ-äÜß', 'κ὚σΟξ'); // 'Üäß-κ὚σΟξ-äÜß', (*442)

Parameters: - string $str <p>The base string.</p> - string|string[] $what <p>String to search for in the base string.</p>, (*443)

Return: - string <p>A string with removed duplicates.</p>, (*444)


remove_html(string $str, string $allowable_tags): string

↑ Remove html via "strip_tags()" from the string., (*445)

Parameters: - string $str <p>The input string.</p> - string $allowable_tags [optional] <p>You can use the optional second parameter to specify tags which should not be stripped. Default: null </p>, (*446)

Return: - string <p>A string with without html tags.</p>, (*447)


remove_html_breaks(string $str, string $replacement): string

↑ Remove all breaks [
| \r\n | \r | \n | ...] from the string., (*448)

Parameters: - string $str <p>The input string.</p> - string $replacement [optional] <p>Default is a empty string.</p>, (*449)

Return: - string <p>A string without breaks.</p>, (*450)


remove_ileft(string $str, string $substring, string $encoding): string

↑ Returns a new string with the prefix $substring removed, if present and case-insensitive., (*451)

Parameters: - string $str <p>The input string.</p> - string $substring <p>The prefix to remove.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*452)

Return: - string <p>A string without the prefix $substring.</p>, (*453)


remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_basic_control_characters): string

↑ Remove invisible characters from a string., (*454)

e.g.: This prevents sandwiching null characters between ascii characters, like Java0script., (*455)

EXAMPLE: UTF8::remove_invisible_characters("κ὚σ0Οξ"); // 'κ὚σΟξ', (*456)

copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php, (*457)

Parameters: - string $str <p>The input string.</p> - bool $url_encoded [optional] <p> Try to remove url encoded control character. WARNING: maybe contains false-positives e.g. aa%0Baa -> aaaa. <br> Default: false </p> - string $replacement [optional] <p>The replacement character.</p> - bool $keep_basic_control_characters [optional] <p>Keep control characters like [LRM] or [LSEP].</p>, (*458)

Return: - string <p>A string without invisible chars.</p>, (*459)


remove_iright(string $str, string $substring, string $encoding): string

↑ Returns a new string with the suffix $substring removed, if present and case-insensitive., (*460)

Parameters: - string $str - string $substring <p>The suffix to remove.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*461)

Return: - string <p>A string having a $str without the suffix $substring.</p>, (*462)


remove_left(string $str, string $substring, string $encoding): string

↑ Returns a new string with the prefix $substring removed, if present., (*463)

Parameters: - string $str <p>The input string.</p> - string $substring <p>The prefix to remove.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*464)

Return: - string <p>A string without the prefix $substring.</p>, (*465)


remove_right(string $str, string $substring, string $encoding): string

↑ Returns a new string with the suffix $substring removed, if present., (*466)

Parameters: - string $str - string $substring <p>The suffix to remove.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*467)

Return: - string <p>A string having a $str without the suffix $substring.</p>, (*468)


replace(string $str, string $search, string $replacement, bool $case_sensitive): string

↑ Replaces all occurrences of $search in $str by $replacement., (*469)

Parameters: - string $str <p>The input string.</p> - string $search <p>The needle to search for.</p> - string $replacement <p>The string to replace with.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p>, (*470)

Return: - string <p>A string with replaced parts.</p>, (*471)


replace_all(string $str, string[] $search, string|string[] $replacement, bool $case_sensitive): string

↑ Replaces all occurrences of $search in $str by $replacement., (*472)

Parameters: - string $str <p>The input string.</p> - string[] $search <p>The elements to search for.</p> - string|string[] $replacement <p>The string to replace with.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p>, (*473)

Return: - string <p>A string with replaced parts.</p>, (*474)


replace_diamond_question_mark(string $str, string $replacement_char, bool $process_invalid_utf8_chars): string

↑ Replace the diamond question mark (�) and invalid-UTF8 chars with the replacement., (*475)

EXAMPLE: UTF8::replace_diamond_question_mark('中文空白�', ''); // '中文空白', (*476)

Parameters: - string $str <p>The input string</p> - string $replacement_char <p>The replacement character.</p> - bool $process_invalid_utf8_chars <p>Convert invalid UTF-8 chars </p>, (*477)

Return: - string <p>A string without diamond question marks (ďż˝).</p>, (*478)


rtrim(string $str, string|null $chars): string

↑ Strip whitespace or other characters from the end of a UTF-8 string., (*479)

EXAMPLE: UTF8::rtrim('-ABC-中文空白- '); // '-ABC-中文空白-', (*480)

Parameters: - string $str <p>The string to be trimmed.</p> - string|null $chars <p>Optional characters to be stripped.</p>, (*481)

Return: - string <p>A string with unwanted characters stripped from the right.</p>, (*482)


showSupport(bool $useEcho): string|void

↑ WARNING: Print native UTF-8 support (libs) by default, e.g. for debugging., (*483)

Parameters: - bool $useEcho, (*484)

Return: - string|void, (*485)


single_chr_html_encode(string $char, bool $keep_ascii_chars, string $encoding): string

↑ Converts a UTF-8 character to HTML Numbered Entity like "{"., (*486)

EXAMPLE: UTF8::single_chr_html_encode('Îş'); // 'Îş', (*487)

Parameters: - T $char <p>The Unicode character to be encoded as numbered entity.</p> - bool $keep_ascii_chars <p>Set to <strong>true</strong> to keep ASCII chars.</> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*488)

Return: - string <p>The HTML numbered entity for the given character.</p>, (*489)


spaces_to_tabs(string $str, int $tab_length): string

↑, (*490)

Parameters: - T $str - int<1, max> $tab_length, (*491)

Return: - string, (*492)


str_camelize(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Returns a camelCase version of the string. Trims surrounding spaces, capitalizes letters following digits, spaces, dashes and underscores, and removes spaces, dashes, as well as underscores., (*493)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*494)

Return: - string, (*495)


str_capitalize_name(string $str): string

↑ Returns the string with the first letter of each word capitalized, except for when the word is a name which shouldn't be capitalized., (*496)

Parameters: - string $str, (*497)

Return: - string <p>A string with $str capitalized.</p>, (*498)


str_contains(string $haystack, string $needle, bool $case_sensitive): bool

↑ Returns true if the string contains $needle, false otherwise. By default the comparison is case-sensitive, but can be made insensitive by setting $case_sensitive to false., (*499)

Parameters: - string $haystack <p>The input string.</p> - string $needle <p>Substring to look for.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p>, (*500)

Return: - bool <p>Whether or not $haystack contains $needle.</p>, (*501)


str_contains_all(string $haystack, scalar[] $needles, bool $case_sensitive): bool

↑ Returns true if the string contains all $needles, false otherwise. By default, the comparison is case-sensitive, but can be made insensitive by setting $case_sensitive to false., (*502)

Parameters: - string $haystack <p>The input string.</p> - scalar[] $needles <p>SubStrings to look for.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p>, (*503)

Return: - bool <p>Whether or not $haystack contains $needle.</p>, (*504)


str_contains_any(string $haystack, scalar[] $needles, bool $case_sensitive): bool

↑ Returns true if the string contains any $needles, false otherwise. By default the comparison is case-sensitive, but can be made insensitive by setting $case_sensitive to false., (*505)

Parameters: - string $haystack <p>The input string.</p> - scalar[] $needles <p>SubStrings to look for.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p>, (*506)

Return: - bool <p>Whether or not $str contains $needle.</p>, (*507)


str_dasherize(string $str, string $encoding): string

↑ Returns a lowercase and trimmed string separated by dashes. Dashes are inserted before uppercase characters (with the exception of the first character of the string), and in place of spaces as well as underscores., (*508)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*509)

Return: - string, (*510)


str_delimit(string $str, string $delimiter, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Returns a lowercase and trimmed string separated by the given delimiter., (*511)

Delimiters are inserted before uppercase characters (with the exception of the first character of the string), and in place of spaces, dashes, and underscores. Alpha delimiters are not converted to lowercase., (*512)

EXAMPLE: UTF8::str_delimit('test case, '#'); // 'test#case' UTF8::str_delimit('test -case', ''); // 'testcase' , (*513)

Parameters: - T $str <p>The input string.</p> - string $delimiter <p>Sequence used to separate parts of the string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*514)

Return: - string, (*515)


str_detect_encoding(string $str): false|string

↑ Optimized "mb_detect_encoding()"-function -> with support for UTF-16 and UTF-32., (*516)

EXAMPLE: UTF8::str_detect_encoding('中文空白'); // 'UTF-8' UTF8::str_detect_encoding('Abc'); // 'ASCII' , (*517)

Parameters: - string $str <p>The input string.</p>, (*518)

Return: - false|string <p> The detected string-encoding e.g. UTF-8 or UTF-16BE,<br> otherwise it will return false e.g. for BINARY or not detected encoding. </p>, (*519)


str_ends_with(string $haystack, string $needle): bool

↑ Check if the string ends with the given substring., (*520)

EXAMPLE: UTF8::str_ends_with('BeginMiddleΚόσμε', 'Κόσμε'); // true UTF8::str_ends_with('BeginMiddleΚόσμε', 'κόσμε'); // false , (*521)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*522)

Return: - bool, (*523)


str_ends_with_any(string $str, string[] $substrings): bool

↑ Returns true if the string ends with any of $substrings, false otherwise., (*524)

  • case-sensitive

Parameters: - string $str <p>The input string.</p> - string[] $substrings <p>Substrings to look for.</p>, (*525)

Return: - bool <p>Whether or not $str ends with $substring.</p>, (*526)


str_ensure_left(string $str, string $substring):

↑ Ensures that the string begins with $substring. If it doesn't, it's prepended., (*527)

Parameters: - T $str <p>The input string.</p> - TSub $substring <p>The substring to add if not present.</p>, (*528)

Return: - TSub is non-empty-string ? non-empty-string : (T is non-empty-string ? non-empty-string : string, (*529)


str_ensure_right(string $str, string $substring): string

↑ Ensures that the string ends with $substring. If it doesn't, it's appended., (*530)

Parameters: - T $str <p>The input string.</p> - TSub $substring <p>The substring to add if not present.</p>, (*531)

Return: - string, (*532)


str_humanize(string $str): string

↑ Capitalizes the first word of the string, replaces underscores with spaces, and strips '_id'., (*533)

Parameters: - string $str, (*534)

Return: - string, (*535)


str_iends_with(string $haystack, string $needle): bool

↑ Check if the string ends with the given substring, case-insensitive., (*536)

EXAMPLE: UTF8::str_iends_with('BeginMiddleΚόσμε', 'Κόσμε'); // true UTF8::str_iends_with('BeginMiddleΚόσμε', 'κόσμε'); // true , (*537)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*538)

Return: - bool, (*539)


str_iends_with_any(string $str, string[] $substrings): bool

↑ Returns true if the string ends with any of $substrings, false otherwise., (*540)

  • case-insensitive

Parameters: - string $str <p>The input string.</p> - string[] $substrings <p>Substrings to look for.</p>, (*541)

Return: - bool <p>Whether or not $str ends with $substring.</p>, (*542)


str_insert(string $str, string $substring, int $index, string $encoding): string

↑ Inserts $substring into the string at the $index provided., (*543)

Parameters: - string $str <p>The input string.</p> - string $substring <p>String to be inserted.</p> - int $index <p>The index at which to insert the substring.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*544)

Return: - string, (*545)


str_ireplace(string|string[] $search, string|string[] $replacement, string|string[] $subject, int $count): string|string[]

↑ Case-insensitive and UTF-8 safe version of str_replace., (*546)

EXAMPLE: UTF8::str_ireplace('lIzÆ', 'lise', 'Iñtërnâtiônàlizætiøn'); // 'Iñtërnâtiônàlisetiøn' , (*547)

Parameters: - string|string[] $search <p> Every replacement with search array is performed on the result of previous replacement. </p> - string|string[] $replacement <p>The replacement.</p> - TStrIReplaceSubject $subject <p> If subject is an array, then the search and replace is performed with every entry of subject, and the return value is an array as well. </p> - int $count [optional] <p> The number of matched and replaced needles will be returned in count which is passed by reference. </p>, (*548)

Return: - string|string[] <p>A string or an array of replacements.</p>, (*549)


str_ireplace_beginning(string $str, string $search, string $replacement): string

↑ Replaces $search from the beginning of string with $replacement., (*550)

Parameters: - string $str <p>The input string.</p> - string $search <p>The string to search for.</p> - string $replacement <p>The replacement.</p>, (*551)

Return: - string <p>The string after the replacement.</p>, (*552)


str_ireplace_ending(string $str, string $search, string $replacement): string

↑ Replaces $search from the ending of string with $replacement., (*553)

Parameters: - string $str <p>The input string.</p> - string $search <p>The string to search for.</p> - string $replacement <p>The replacement.</p>, (*554)

Return: - string <p>The string after the replacement.</p>, (*555)


str_istarts_with(string $haystack, string $needle): bool

↑ Check if the string starts with the given substring, case-insensitive., (*556)

EXAMPLE: UTF8::str_istarts_with('ΚόσμεMiddleEnd', 'Κόσμε'); // true UTF8::str_istarts_with('ΚόσμεMiddleEnd', 'κόσμε'); // true , (*557)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*558)

Return: - bool, (*559)


str_istarts_with_any(string $str, scalar[] $substrings): bool

↑ Returns true if the string begins with any of $substrings, false otherwise., (*560)

  • case-insensitive

Parameters: - string $str <p>The input string.</p> - scalar[] $substrings <p>Substrings to look for.</p>, (*561)

Return: - bool <p>Whether or not $str starts with $substring.</p>, (*562)


str_isubstr_after_first_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring after the first occurrence of a separator., (*563)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*564)

Return: - string, (*565)


str_isubstr_after_last_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring after the last occurrence of a separator., (*566)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*567)

Return: - string, (*568)


str_isubstr_before_first_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring before the first occurrence of a separator., (*569)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*570)

Return: - string, (*571)


str_isubstr_before_last_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring before the last occurrence of a separator., (*572)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*573)

Return: - string, (*574)


str_isubstr_first(string $str, string $needle, bool $before_needle, string $encoding): string

↑ Gets the substring after (or before via "$before_needle") the first occurrence of the "$needle"., (*575)

Parameters: - string $str <p>The input string.</p> - string $needle <p>The string to look for.</p> - bool $before_needle [optional] <p>Default: false</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*576)

Return: - string, (*577)


str_isubstr_last(string $str, string $needle, bool $before_needle, string $encoding): string

↑ Gets the substring after (or before via "$before_needle") the last occurrence of the "$needle"., (*578)

Parameters: - string $str <p>The input string.</p> - string $needle <p>The string to look for.</p> - bool $before_needle [optional] <p>Default: false</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*579)

Return: - string, (*580)


str_last_char(string $str, int $n, string $encoding): string

↑ Returns the last $n characters of the string., (*581)

Parameters: - string $str <p>The input string.</p> - int $n <p>Number of characters to retrieve from the end.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*582)

Return: - string, (*583)


str_limit(string $str, int $length, string $str_add_on, string $encoding): string

↑ Limit the number of characters in a string., (*584)

Parameters: - T $str <p>The input string.</p> - int<1, max> $length [optional] <p>Default: 100</p> - string $str_add_on [optional] <p>Default: …</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*585)

Return: - string, (*586)


str_limit_after_word(string $str, int $length, string $str_add_on, string $encoding): string

↑ Limit the number of characters in a string, but also after the next word., (*587)

EXAMPLE: UTF8::str_limit_after_word('fòô bàř fòô', 8, ''); // 'fòô bàř', (*588)

Parameters: - T $str <p>The input string.</p> - int<1, max> $length [optional] <p>Default: 100</p> - string $str_add_on [optional] <p>Default: …</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*589)

Return: - string, (*590)


str_longest_common_prefix(string $str1, string $str2, string $encoding): string

↑ Returns the longest common prefix between the $str1 and $str2., (*591)

Parameters: - string $str1 <p>The input sting.</p> - string $str2 <p>Second string for comparison.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*592)

Return: - string, (*593)


str_longest_common_substring(string $str1, string $str2, string $encoding): string

↑ Returns the longest common substring between the $str1 and $str2., (*594)

In the case of ties, it returns that which occurs first., (*595)

Parameters: - string $str1 - string $str2 <p>Second string for comparison.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*596)

Return: - string <p>A string with its $str being the longest common substring.</p>, (*597)


str_longest_common_suffix(string $str1, string $str2, string $encoding): string

↑ Returns the longest common suffix between the $str1 and $str2., (*598)

Parameters: - string $str1 - string $str2 <p>Second string for comparison.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*599)

Return: - string, (*600)


str_matches_pattern(string $str, string $pattern): bool

↑ Returns true if $str matches the supplied pattern, false otherwise., (*601)

Parameters: - string $str <p>The input string.</p> - string $pattern <p>Regex pattern to match against.</p>, (*602)

Return: - bool <p>Whether or not $str matches the pattern.</p>, (*603)


str_obfuscate(string $str, float $percent, string $obfuscateChar, string[] $keepChars): string

↑ Convert a string into a obfuscate string., (*604)

EXAMPLE: , (*605)

UTF8::str_obfuscate('lars@moelleken.org', 0.5, '*', ['@', '.']); // e.g. "l***@m**lleke*.*r*" , (*606)

Parameters: - string $str - float $percent - string $obfuscateChar - string[] $keepChars, (*607)

Return: - string <p>The obfuscate string.</p>, (*608)


str_offset_exists(string $str, int $offset, string $encoding): bool

↑ Returns whether or not a character exists at an index. Offsets may be negative to count from the last character in the string. Implements part of the ArrayAccess interface., (*609)

Parameters: - string $str <p>The input string.</p> - int $offset <p>The index to check.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*610)

Return: - bool <p>Whether or not the index exists.</p>, (*611)


str_offset_get(string $str, int $index, string $encoding): string

↑ Returns the character at the given index. Offsets may be negative to count from the last character in the string. Implements part of the ArrayAccess interface, and throws an OutOfBoundsException if the index does not exist., (*612)

Parameters: - string $str <p>The input string.</p> - int<1, max> $index <p>The <strong>index</strong> from which to retrieve the char.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*613)

Return: - string <p>The character at the specified index.</p>, (*614)


str_pad(string $str, int $pad_length, string $pad_string, int|string $pad_type, string $encoding): string

↑ Pad a UTF-8 string to a given length with another string., (*615)

EXAMPLE: UTF8::str_pad('中文空白', 10, '_', STR_PAD_BOTH); // '___中文空白___', (*616)

Parameters: - string $str <p>The input string.</p> - int $pad_length <p>The length of return string.</p> - string $pad_string [optional] <p>String to use for padding the input string.</p> - int|string $pad_type [optional] <p> Can be <strong>STR_PAD_RIGHT</strong> (default), [or string "right"]<br> <strong>STR_PAD_LEFT</strong> [or string "left"] or<br> <strong>STR_PAD_BOTH</strong> [or string "both"] </p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*617)

Return: - string <p>Returns the padded string.</p>, (*618)


str_pad_both(string $str, int $length, string $pad_str, string $encoding): string

↑ Returns a new string of a given length such that both sides of the string are padded. Alias for "UTF8::str_pad()" with a $pad_type of 'both'., (*619)

Parameters: - string $str - int $length <p>Desired string length after padding.</p> - string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*620)

Return: - string <p>The string with padding applied.</p>, (*621)


str_pad_left(string $str, int $length, string $pad_str, string $encoding): string

↑ Returns a new string of a given length such that the beginning of the string is padded. Alias for "UTF8::str_pad()" with a $pad_type of 'left'., (*622)

Parameters: - string $str - int $length <p>Desired string length after padding.</p> - string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*623)

Return: - string <p>The string with left padding.</p>, (*624)


str_pad_right(string $str, int $length, string $pad_str, string $encoding): string

↑ Returns a new string of a given length such that the end of the string is padded. Alias for "UTF8::str_pad()" with a $pad_type of 'right'., (*625)

Parameters: - string $str - int $length <p>Desired string length after padding.</p> - string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*626)

Return: - string <p>The string with right padding.</p>, (*627)


str_repeat(string $str, int $multiplier): string

↑ Repeat a string., (*628)

EXAMPLE: UTF8::str_repeat("°~\xf0\x90\x28\xbc", 2); // '°~ð(Ÿ°~ð(Ÿ', (*629)

Parameters: - T $str <p> The string to be repeated. </p> - int<1, max> $multiplier <p> Number of time the input string should be repeated. </p> <p> multiplier has to be greater than or equal to 0. If the multiplier is set to 0, the function will return an empty string. </p>, (*630)

Return: - string <p>The repeated string.</p>, (*631)


str_replace_beginning(string $str, string $search, string $replacement): string

↑ Replaces $search from the beginning of string with $replacement., (*632)

Parameters: - string $str <p>The input string.</p> - string $search <p>The string to search for.</p> - string $replacement <p>The replacement.</p>, (*633)

Return: - string <p>A string after the replacements.</p>, (*634)


str_replace_ending(string $str, string $search, string $replacement): string

↑ Replaces $search from the ending of string with $replacement., (*635)

Parameters: - string $str <p>The input string.</p> - string $search <p>The string to search for.</p> - string $replacement <p>The replacement.</p>, (*636)

Return: - string <p>A string after the replacements.</p>, (*637)


str_replace_first(string $search, string $replace, string $subject): string

↑ Replace the first "$search"-term with the "$replace"-term., (*638)

Parameters: - string $search - string $replace - string $subject, (*639)

Return: - string, (*640)


str_replace_last(string $search, string $replace, string $subject): string

↑ Replace the last "$search"-term with the "$replace"-term., (*641)

Parameters: - string $search - string $replace - string $subject, (*642)

Return: - string, (*643)


str_shuffle(string $str, string $encoding): string

↑ Shuffles all the characters in the string., (*644)

INFO: uses random algorithm which is weak for cryptography purposes, (*645)

EXAMPLE: UTF8::str_shuffle('fòô bàř fòô'); // 'àòôřb ffòô ', (*646)

Parameters: - T $str <p>The input string</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*647)

Return: - string <p>The shuffled string.</p>, (*648)


str_slice(string $str, int $start, int|null $end, string $encoding): false|string

↑ Returns the substring beginning at $start, and up to, but not including the index specified by $end. If $end is omitted, the function extracts the remaining string. If $end is negative, it is computed from the end of the string., (*649)

Parameters: - string $str - int $start <p>Initial index from which to begin extraction.</p> - int|null $end [optional] <p>Index at which to end extraction. Default: null</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*650)

Return: - false|string <p>The extracted substring.</p><p>If <i>str</i> is shorter than <i>start</i> characters long, <b>FALSE</b> will be returned., (*651)


str_snakeize(string $str, string $encoding): string

↑ Convert a string to e.g.: "snake_case", (*652)

Parameters: - string $str - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*653)

Return: - string <p>A string in snake_case.</p>, (*654)


str_sort(string $str, bool $unique, bool $desc): string

↑ Sort all characters according to code points., (*655)

EXAMPLE: UTF8::str_sort(' -ABC-中文空白- '); // ' ---ABC中文白空', (*656)

Parameters: - string $str <p>A UTF-8 string.</p> - bool $unique <p>Sort unique. If <strong>true</strong>, repeated characters are ignored.</p> - bool $desc <p>If <strong>true</strong>, will sort characters in reverse code point order.</p>, (*657)

Return: - string <p>A string of sorted characters.</p>, (*658)


str_split(int|string $str, int $length, bool $clean_utf8, bool $try_to_use_mb_functions): list

↑ Convert a string to an array of unicode characters., (*659)

EXAMPLE: UTF8::str_split('中文空白'); // array('中', '文', '空', '白'), (*660)

Parameters: - int|string $str <p>The string or int to split into array.</p> - int<1, max> $length [optional] <p>Max character length of each array element.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use "mb_substr"</p>, (*661)

Return: - list<string> <p>An array containing chunks of chars from the input.</p>, (*662)


str_split_array(int[]|string[] $input, int $length, bool $clean_utf8, bool $try_to_use_mb_functions): listlist

↑ Convert a string to an array of Unicode characters., (*663)

EXAMPLE: UTF8::str_split_array(['中文空白', 'test'], 2); // [['中文', '空白'], ['te', 'st']] , (*664)

Parameters: - int[]|string[] $input <p>The string[] or int[] to split into array.</p> - int<1, max> $length [optional] <p>Max character length of each array element.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use "mb_substr"</p>, (*665)

Return: - list<list<string>> <p>An array containing chunks of the input.</p>, (*666)


str_split_pattern(string $str, string $pattern, int $limit): string[]

↑ Splits the string with the provided regular expression, returning an array of strings. An optional integer $limit will truncate the results., (*667)

Parameters: - string $str - string $pattern <p>The regex with which to split the string.</p> - int $limit [optional] <p>Maximum number of results to return. Default: -1 === no limit</p>, (*668)

Return: - string[] <p>An array of strings.</p>, (*669)


str_starts_with(string $haystack, string $needle): bool

↑ Check if the string starts with the given substring., (*670)

EXAMPLE: UTF8::str_starts_with('ΚόσμεMiddleEnd', 'Κόσμε'); // true UTF8::str_starts_with('ΚόσμεMiddleEnd', 'κόσμε'); // false , (*671)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*672)

Return: - bool, (*673)


str_starts_with_any(string $str, scalar[] $substrings): bool

↑ Returns true if the string begins with any of $substrings, false otherwise., (*674)

  • case-sensitive

Parameters: - string $str <p>The input string.</p> - scalar[] $substrings <p>Substrings to look for.</p>, (*675)

Return: - bool <p>Whether or not $str starts with $substring.</p>, (*676)


str_substr_after_first_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring after the first occurrence of a separator., (*677)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*678)

Return: - string, (*679)


str_substr_after_last_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring after the last occurrence of a separator., (*680)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*681)

Return: - string, (*682)


str_substr_before_first_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring before the first occurrence of a separator., (*683)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*684)

Return: - string, (*685)


str_substr_before_last_separator(string $str, string $separator, string $encoding): string

↑ Gets the substring before the last occurrence of a separator., (*686)

Parameters: - string $str <p>The input string.</p> - string $separator <p>The string separator.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*687)

Return: - string, (*688)


str_substr_first(string $str, string $needle, bool $before_needle, string $encoding): string

↑ Gets the substring after (or before via "$before_needle") the first occurrence of the "$needle"., (*689)

Parameters: - string $str <p>The input string.</p> - string $needle <p>The string to look for.</p> - bool $before_needle [optional] <p>Default: false</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*690)

Return: - string, (*691)


str_substr_last(string $str, string $needle, bool $before_needle, string $encoding): string

↑ Gets the substring after (or before via "$before_needle") the last occurrence of the "$needle"., (*692)

Parameters: - string $str <p>The input string.</p> - string $needle <p>The string to look for.</p> - bool $before_needle [optional] <p>Default: false</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*693)

Return: - string, (*694)


str_surround(string $str, string $substring): string

↑ Surrounds $str with the given substring., (*695)

Parameters: - T $str - TSub $substring <p>The substring to add to both sides.</p>, (*696)

Return: - string <p>A string with the substring both prepended and appended.</p>, (*697)


str_titleize(string $str, string[]|null $ignore, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length, bool $use_trim_first, string|null $word_define_chars): string

↑ Returns a trimmed string with the first letter of each word capitalized., (*698)

Also accepts an array, $ignore, allowing you to list words not to be capitalized., (*699)

Parameters: - string $str - string[]|null $ignore [optional] <p>An array of words not to capitalize or null. Default: null</p> - string $encoding [optional] <p>Default: 'UTF-8'</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p> - bool $use_trim_first [optional] <p>true === trim the input string, first</p> - string|null $word_define_chars [optional] <p>An string of chars that will be used as whitespace separator === words.</p>, (*700)

Return: - string <p>The titleized string.</p>, (*701)


str_titleize_for_humans(string $str, string[] $ignore, string $encoding): string

↑ Returns a trimmed string in proper title case., (*702)

Also accepts an array, $ignore, allowing you to list words not to be capitalized., (*703)

Adapted from John Gruber's script., (*704)

Parameters: - string $str - string[] $ignore <p>An array of words not to capitalize.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*705)

Return: - string <p>The titleized string.</p>, (*706)


str_to_binary(string $str): false|string

↑ Get a binary representation of a specific string., (*707)

EXAPLE: UTF8::str_to_binary('😃'); // '11110000100111111001100010000011', (*708)

Parameters: - string $str <p>The input string.</p>, (*709)

Return: - false|string <p>false on error</p>, (*710)


str_to_lines(string $str, bool $remove_empty_values, int|null $remove_short_values): string[]

↑, (*711)

Parameters: - string $str - bool $remove_empty_values <p>Remove empty values.</p> - int|null $remove_short_values <p>The min. string length or null to disable</p>, (*712)

Return: - string[], (*713)


str_to_words(string $str, string $char_list, bool $remove_empty_values, int|null $remove_short_values): list

↑ Convert a string into an array of words., (*714)

EXAMPLE: UTF8::str_to_words('中文空白 oöäü#s', '#') // array('', '中文空白', ' ', 'oöäü#s', ''), (*715)

Parameters: - string $str - string $char_list <p>Additional chars for the definition of "words".</p> - bool $remove_empty_values <p>Remove empty values.</p> - int|null $remove_short_values <p>The min. string length or null to disable</p>, (*716)

Return: - list<string>, (*717)


str_truncate(string $str, int $length, string $substring, string $encoding): string

↑ Truncates the string to a given length. If $substring is provided, and truncating occurs, the string is further truncated so that the substring may be appended without exceeding the desired length., (*718)

Parameters: - string $str - int $length <p>Desired length of the truncated string.</p> - string $substring [optional] <p>The substring to append if it can fit. Default: ''</p> - string $encoding [optional] <p>Default: 'UTF-8'</p>, (*719)

Return: - string <p>A string after truncating.</p>, (*720)


str_truncate_safe(string $str, int $length, string $substring, string $encoding, bool $ignore_do_not_split_words_for_one_word): string

↑ Truncates the string to a given length, while ensuring that it does not split words. If $substring is provided, and truncating occurs, the string is further truncated so that the substring may be appended without exceeding the desired length., (*721)

Parameters: - string $str - int $length <p>Desired length of the truncated string.</p> - string $substring [optional] <p>The substring to append if it can fit. Default: ''</p> - string $encoding [optional] <p>Default: 'UTF-8'</p> - bool $ignore_do_not_split_words_for_one_word [optional] <p>Default: false</p>, (*722)

Return: - string <p>A string after truncating.</p>, (*723)


str_underscored(string $str): string

↑ Returns a lowercase and trimmed string separated by underscores., (*724)

Underscores are inserted before uppercase characters (with the exception of the first character of the string), and in place of spaces as well as dashes., (*725)

Parameters: - string $str, (*726)

Return: - string <p>The underscored string.</p>, (*727)


str_upper_camelize(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Returns an UpperCamelCase version of the supplied string. It trims surrounding spaces, capitalizes letters following digits, spaces, dashes and underscores, and removes spaces, dashes, underscores., (*728)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Default: 'UTF-8'</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*729)

Return: - string <p>A string in UpperCamelCase.</p>, (*730)


str_word_count(string $str, int $format, string $char_list): int|string[]

↑ Get the number of words in a specific string., (*731)

EXAMPLES: // format: 0 -> return only word count (int) // UTF8::str_word_count('中文空白 öäü abc#c'); // 4 UTF8::str_word_count('中文空白 öäü abc#c', 0, '#'); // 3, (*732)

// format: 1 -> return words (array) // UTF8::str_word_count('中文空白 öäü abc#c', 1); // array('中文空白', 'öäü', 'abc', 'c') UTF8::str_word_count('中文空白 öäü abc#c', 1, '#'); // array('中文空白', 'öäü', 'abc#c'), (*733)

// format: 2 -> return words with offset (array) // UTF8::str_word_count('中文空白 öäü ab#c', 2); // array(0 => '中文空白', 5 => 'öäü', 9 => 'abc', 13 => 'c') UTF8::str_word_count('中文空白 öäü ab#c', 2, '#'); // array(0 => '中文空白', 5 => 'öäü', 9 => 'abc#c') , (*734)

Parameters: - string $str <p>The input string.</p> - 0|1|2 $format [optional] <p> <strong>0</strong> => return a number of words (default)<br> <strong>1</strong> => return an array of words<br> <strong>2</strong> => return an array of words with word-offset as key </p> - string $char_list [optional] <p>Additional chars that contains to words and do not start a new word.</p>, (*735)

Return: - int|string[] <p>The number of words in the string.</p>, (*736)


strcasecmp(string $str1, string $str2, string $encoding): int

↑ Case-insensitive string comparison., (*737)

INFO: Case-insensitive version of UTF8::strcmp(), (*738)

EXAMPLE: UTF8::strcasecmp("iùtÍrnâtiôn\nàlizÌtiøn", "IùtÍrnâtiôn\nàlizÌtiøn"); // 0, (*739)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*740)

Return: - int <strong>&lt; 0</strong> if str1 is less than str2;<br> <strong>&gt; 0</strong> if str1 is greater than str2,<br> <strong>0</strong> if they are equal, (*741)


strcmp(string $str1, string $str2): int

↑ Case-sensitive string comparison., (*742)

EXAMPLE: UTF8::strcmp("iùtÍrnâtiôn\nàlizÌtiøn", "iùtÍrnâtiôn\nàlizÌtiøn"); // 0, (*743)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p>, (*744)

Return: - int <strong>&lt; 0</strong> if str1 is less than str2<br> <strong>&gt; 0</strong> if str1 is greater than str2<br> <strong>0</strong> if they are equal, (*745)


strcspn(string $str, string $char_list, int $offset, int|null $length, string $encoding): int

↑ Find length of initial segment not matching mask., (*746)

Parameters: - string $str - string $char_list - int $offset - int|null $length - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*747)

Return: - int, (*748)


string(int|int[]|string|string[] $intOrHex): string

↑ Create a UTF-8 string from code points., (*749)

INFO: opposite to UTF8::codepoints(), (*750)

EXAMPLE: UTF8::string(array(246, 228, 252)); // 'Üäß', (*751)

Parameters: - int[]|numeric-string[]|int|numeric-string $intOrHex <p>Integer or Hexadecimal codepoints.</p>, (*752)

Return: - string <p>A UTF-8 encoded string.</p>, (*753)


string_has_bom(string $str): bool

↑ Checks if string starts with "BOM" (Byte Order Mark Character) character., (*754)

EXAMPLE: UTF8::string_has_bom("\xef\xbb\xbf foobar"); // true, (*755)

Parameters: - string $str <p>The input string.</p>, (*756)

Return: - bool <p> <strong>true</strong> if the string has BOM at the start,<br> <strong>false</strong> otherwise </p>, (*757)


strip_tags(string $str, string|null $allowable_tags, bool $clean_utf8): string

↑ Strip HTML and PHP tags from a string + clean invalid UTF-8., (*758)

EXAMPLE: UTF8::strip_tags("κ὚σΟξ\xa0\xa1"); // 'κ὚σΟξ', (*759)

Parameters: - string $str <p> The input string. </p> - string|null $allowable_tags [optional] <p> You can use the optional second parameter to specify tags which should not be stripped. </p> <p> HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tags. </p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*760)

Return: - string <p>The stripped string.</p>, (*761)


strip_whitespace(string $str): string

↑ Strip all whitespace characters. This includes tabs and newline characters, as well as multibyte whitespace such as the thin space and ideographic space., (*762)

EXAMPLE: UTF8::strip_whitespace(' Ο συγγραφέας '); // 'Οσυγγραφέας', (*763)

Parameters: - string $str, (*764)

Return: - string, (*765)


stripos(string $haystack, string $needle, int $offset, string $encoding, bool $clean_utf8): false|int

↑ Find the position of the first occurrence of a substring in a string, case-insensitive., (*766)

INFO: use UTF8::stripos_in_byte() for the byte-length, (*767)

EXAMPLE: UTF8::stripos('aσσb', 'ΣΣ'); // 1 (σσ == ΣΣ), (*768)

Parameters: - string $haystack <p>The string from which to get the position of the first occurrence of needle.</p> - string $needle <p>The string to find in haystack.</p> - int $offset [optional] <p>The position in haystack to start searching.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*769)

Return: - false|int Return the <strong>(int)</strong> numeric position of the first occurrence of needle in the haystack string,<br> or <strong>false</strong> if needle is not found, (*770)


stripos_in_byte(string $haystack, string $needle, int $offset): false|int

↑ Find the position of the first occurrence of a substring in a string, case-insensitive., (*771)

Parameters: - string $haystack <p> The string being checked. </p> - string $needle <p> The position counted from the beginning of haystack. </p> - int $offset [optional] <p> The search offset. If it is not specified, 0 is used. </p>, (*772)

Return: - false|int <p>The numeric position of the first occurrence of needle in the haystack string. If needle is not found, it returns false.</p>, (*773)


stristr(string $haystack, string $needle, bool $before_needle, string $encoding, bool $clean_utf8): false|string

↑ Returns all of haystack starting from and including the first occurrence of needle to the end., (*774)

EXAMPLE: $str = 'iñtërnâtiônàlizætiøn'; $search = 'NÂT';, (*775)

UTF8::stristr($str, $search)); // 'nâtiônàlizÌtiøn' UTF8::stristr($str, $search, true)); // 'iùtÍr' , (*776)

Parameters: - string $haystack <p>The input string. Must be valid UTF-8.</p> - string $needle <p>The string to look for. Must be valid UTF-8.</p> - bool $before_needle [optional] <p> If <b>TRUE</b>, it returns the part of the haystack before the first occurrence of the needle (excluding the needle). </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*777)

Return: - false|string <p>A sub-string,<br>or <strong>false</strong> if needle is not found.</p>, (*778)


strlen(string $str, string $encoding, bool $clean_utf8): false|int

↑ Get the string length, not the byte-length!, (*779)

INFO: use UTF8::strwidth() for the char-length, (*780)

EXAMPLE: UTF8::strlen("IùtÍrnâtiôn\xE9àlizÌtiøn")); // 20, (*781)

Parameters: - string $str <p>The string being checked for length.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*782)

Return: - false|int <p> The number <strong>(int)</strong> of characters in the string $str having character encoding $encoding. (One multi-byte character counted as +1). <br> Can return <strong>false</strong>, if e.g. mbstring is not installed and we process invalid chars. </p>, (*783)


strlen_in_byte(string $str): int

↑ Get string length in byte., (*784)

Parameters: - string $str, (*785)

Return: - int, (*786)


strnatcasecmp(string $str1, string $str2, string $encoding): int

↑ Case-insensitive string comparisons using a "natural order" algorithm., (*787)

INFO: natural order version of UTF8::strcasecmp(), (*788)

EXAMPLES: UTF8::strnatcasecmp('2', '10Hello WORLD 中文空白!'); // -1 UTF8::strcasecmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // 1, (*789)

UTF8::strnatcasecmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // 1 UTF8::strcasecmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // -1 , (*790)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*791)

Return: - int <strong>&lt; 0</strong> if str1 is less than str2<br> <strong>&gt; 0</strong> if str1 is greater than str2<br> <strong>0</strong> if they are equal, (*792)


strnatcmp(string $str1, string $str2): int

↑ String comparisons using a "natural order" algorithm, (*793)

INFO: natural order version of UTF8::strcmp(), (*794)

EXAMPLES: UTF8::strnatcmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // -1 UTF8::strcmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // 1, (*795)

UTF8::strnatcmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // 1 UTF8::strcmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // -1 , (*796)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p>, (*797)

Return: - int <strong>&lt; 0</strong> if str1 is less than str2;<br> <strong>&gt; 0</strong> if str1 is greater than str2;<br> <strong>0</strong> if they are equal, (*798)


strncasecmp(string $str1, string $str2, int $len, string $encoding): int

↑ Case-insensitive string comparison of the first n characters., (*799)

EXAMPLE: UTF8::strcasecmp("iùtÍrnâtiôn\nàlizÌtiøn321", "iùtÍrnâtiôn\nàlizÌtiøn123", 5); // 0 , (*800)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p> - int $len <p>The length of strings to be used in the comparison.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*801)

Return: - int <strong>&lt; 0</strong> if <i>str1</i> is less than <i>str2</i>;<br> <strong>&gt; 0</strong> if <i>str1</i> is greater than <i>str2</i>;<br> <strong>0</strong> if they are equal, (*802)


strncmp(string $str1, string $str2, int $len, string $encoding): int

↑ String comparison of the first n characters., (*803)

EXAMPLE: UTF8::strncmp("IùtÍrnâtiôn\nàlizÌtiøn321", "IùtÍrnâtiôn\nàlizÌtiøn123", 5); // 0 , (*804)

Parameters: - string $str1 <p>The first string.</p> - string $str2 <p>The second string.</p> - int $len <p>Number of characters to use in the comparison.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*805)

Return: - int <strong>&lt; 0</strong> if <i>str1</i> is less than <i>str2</i>;<br> <strong>&gt; 0</strong> if <i>str1</i> is greater than <i>str2</i>;<br> <strong>0</strong> if they are equal, (*806)


strpbrk(string $haystack, string $char_list): false|string

↑ Search a string for any of a set of characters., (*807)

EXAMPLE: UTF8::strpbrk('-中文空白-', '白'); // '白-', (*808)

Parameters: - string $haystack <p>The string where char_list is looked for.</p> - string $char_list <p>This parameter is case-sensitive.</p>, (*809)

Return: - false|string <p>The string starting from the character found, or false if it is not found.</p>, (*810)


strpos(string $haystack, int|string $needle, int $offset, string $encoding, bool $clean_utf8): false|int

↑ Find the position of the first occurrence of a substring in a string., (*811)

INFO: use UTF8::strpos_in_byte() for the byte-length, (*812)

EXAMPLE: UTF8::strpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 8, (*813)

Parameters: - string $haystack <p>The string from which to get the position of the first occurrence of needle.</p> - int|string $needle <p>The string to find in haystack.<br>Or a code point as int.</p> - int $offset [optional] <p>The search offset. If it is not specified, 0 is used.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*814)

Return: - false|int The <strong>(int)</strong> numeric position of the first occurrence of needle in the haystack string.<br> If needle is not found it returns false., (*815)


strpos_in_byte(string $haystack, string $needle, int $offset): false|int

↑ Find the position of the first occurrence of a substring in a string., (*816)

Parameters: - string $haystack <p> The string being checked. </p> - string $needle <p> The position counted from the beginning of haystack. </p> - int $offset [optional] <p> The search offset. If it is not specified, 0 is used. </p>, (*817)

Return: - false|int <p>The numeric position of the first occurrence of needle in the haystack string. If needle is not found, it returns false.</p>, (*818)


strrchr(string $haystack, string $needle, bool $before_needle, string $encoding, bool $clean_utf8): false|string

↑ Find the last occurrence of a character in a string within another., (*819)

EXAMPLE: UTF8::strrchr('κ὚σΟξκ὚σΟξ-äÜß', 'κ὚σΟξ'); // 'κ὚σΟξ-äÜß', (*820)

Parameters: - string $haystack <p>The string from which to get the last occurrence of needle.</p> - string $needle <p>The string to find in haystack</p> - bool $before_needle [optional] <p> Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the last occurrence of needle. If set to false, it returns all of haystack from the last occurrence of needle to the end, </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*821)

Return: - false|string <p>The portion of haystack or false if needle is not found.</p>, (*822)


strrev(string $str, string $encoding): string

↑ Reverses characters order in the string., (*823)

EXAMPLE: UTF8::strrev('κ-Üäß'); // 'ßäÜ-κ', (*824)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*825)

Return: - string <p>The string with characters in the reverse sequence.</p>, (*826)


strrichr(string $haystack, string $needle, bool $before_needle, string $encoding, bool $clean_utf8): false|string

↑ Find the last occurrence of a character in a string within another, case-insensitive., (*827)

EXAMPLE: UTF8::strrichr('Aκ὚σΟξκ὚σΟξ-äÜß', 'aκ὚σΟξ'); // 'Aκ὚σΟξκ὚σΟξ-äÜß', (*828)

Parameters: - string $haystack <p>The string from which to get the last occurrence of needle.</p> - string $needle <p>The string to find in haystack.</p> - bool $before_needle [optional] <p> Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the last occurrence of needle. If set to false, it returns all of haystack from the last occurrence of needle to the end, </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*829)

Return: - false|string <p>The portion of haystack or<br>false if needle is not found.</p>, (*830)


strripos(string $haystack, int|string $needle, int $offset, string $encoding, bool $clean_utf8): false|int

↑ Find the position of the last occurrence of a substring in a string, case-insensitive., (*831)

EXAMPLE: UTF8::strripos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13, (*832)

Parameters: - string $haystack <p>The string to look in.</p> - int|string $needle <p>The string to look for.</p> - int $offset [optional] <p>Number of characters to ignore in the beginning or end.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*833)

Return: - false|int <p>The <strong>(int)</strong> numeric position of the last occurrence of needle in the haystack string.<br>If needle is not found, it returns false.</p>, (*834)


strripos_in_byte(string $haystack, string $needle, int $offset): false|int

↑ Finds position of last occurrence of a string within another, case-insensitive., (*835)

Parameters: - string $haystack <p> The string from which to get the position of the last occurrence of needle. </p> - string $needle <p> The string to find in haystack. </p> - int $offset [optional] <p> The position in haystack to start searching. </p>, (*836)

Return: - false|int <p>eturn the numeric position of the last occurrence of needle in the haystack string, or false if needle is not found.</p>, (*837)


strrpos(string $haystack, int|string $needle, int $offset, string $encoding, bool $clean_utf8): false|int

↑ Find the position of the last occurrence of a substring in a string., (*838)

EXAMPLE: UTF8::strrpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13, (*839)

Parameters: - string $haystack <p>The string being checked, for the last occurrence of needle</p> - int|string $needle <p>The string to find in haystack.<br>Or a code point as int.</p> - int $offset [optional] <p>May be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string. </p> - string $encoding [optional] <p>Set the charset.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*840)

Return: - false|int <p>The <strong>(int)</strong> numeric position of the last occurrence of needle in the haystack string.<br>If needle is not found, it returns false.</p>, (*841)


strrpos_in_byte(string $haystack, string $needle, int $offset): false|int

↑ Find the position of the last occurrence of a substring in a string., (*842)

Parameters: - string $haystack <p> The string being checked, for the last occurrence of needle. </p> - string $needle <p> The string to find in haystack. </p> - int $offset [optional] <p>May be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string. </p>, (*843)

Return: - false|int <p>The numeric position of the last occurrence of needle in the haystack string. If needle is not found, it returns false.</p>, (*844)


strspn(string $str, string $mask, int $offset, int|null $length, string $encoding): false|int

↑ Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask., (*845)

EXAMPLE: UTF8::strspn('iùtÍrnâtiônàlizÌtiøn', 'itù'); // '3', (*846)

Parameters: - string $str <p>The input string.</p> - string $mask <p>The mask of chars</p> - int $offset [optional] - int|null $length [optional] - string $encoding [optional] <p>Set the charset.</p>, (*847)

Return: - false|int, (*848)


strstr(string $haystack, string $needle, bool $before_needle, string $encoding, bool $clean_utf8): false|string

↑ Returns part of haystack string from the first occurrence of needle to the end of haystack., (*849)

EXAMPLE: $str = 'iùtÍrnâtiônàlizÌtiøn'; $search = 'nât';, (*850)

UTF8::strstr($str, $search)); // 'nâtiônàlizÌtiøn' UTF8::strstr($str, $search, true)); // 'iùtÍr' , (*851)

Parameters: - string $haystack <p>The input string. Must be valid UTF-8.</p> - string $needle <p>The string to look for. Must be valid UTF-8.</p> - bool $before_needle [optional] <p> If <b>TRUE</b>, strstr() returns the part of the haystack before the first occurrence of the needle (excluding the needle). </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*852)

Return: - false|string <p>A sub-string,<br>or <strong>false</strong> if needle is not found.</p>, (*853)


strstr_in_byte(string $haystack, string $needle, bool $before_needle): false|string

↑ Finds first occurrence of a string within another., (*854)

Parameters: - string $haystack <p> The string from which to get the first occurrence of needle. </p> - string $needle <p> The string to find in haystack. </p> - bool $before_needle [optional] <p> Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the first occurrence of needle. If set to false, it returns all of haystack from the first occurrence of needle to the end, </p>, (*855)

Return: - false|string <p>The portion of haystack, or false if needle is not found.</p>, (*856)


strtocasefold(string $str, bool $full, bool $clean_utf8, string $encoding, string|null $lang, bool $lower): string

↑ Unicode transformation for case-less matching., (*857)

EXAMPLE: UTF8::strtocasefold('ǰ◌̱'); // 'ǰ◌̱', (*858)

Parameters: - string $str <p>The input string.</p> - bool $full [optional] <p> <b>true</b>, replace full case folding chars (default)<br> <b>false</b>, use only limited static array [UTF8::$COMMON_CASE_FOLD] </p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string $encoding [optional] <p>Set the charset.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $lower [optional] <p>Use lowercase string, otherwise use uppercase string. PS: uppercase is for some languages better ...</p>, (*859)

Return: - string, (*860)


strtolower(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Make a string lowercase., (*861)

EXAMPLE: UTF8::strtolower('DÉJÀ Σσς Iıİi'); // 'déjà σσς iıii', (*862)

Parameters: - string $str <p>The string being lowercased.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*863)

Return: - string <p>String with all alphabetic characters converted to lowercase.</p>, (*864)


strtoupper(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Make a string uppercase., (*865)

EXAMPLE: UTF8::strtoupper('Déjà Σσς Iıİi'); // 'DÉJÀ ΣΣΣ IIİI', (*866)

Parameters: - string $str <p>The string being uppercased.</p> - string $encoding [optional] <p>Set the charset.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*867)

Return: - string <p>String with all alphabetic characters converted to uppercase.</p>, (*868)


strtr(string $str, string|string[] $from, string|string[] $to): string

↑ Translate characters or replace sub-strings., (*869)

EXAMPLE: $array = [ 'Hello' => '○●◎', '中文空白' => 'earth', ]; UTF8::strtr('Hello 中文空白', $array); // '○●◎ earth' , (*870)

Parameters: - string $str <p>The string being translated.</p> - string|string[] $from <p>The string replacing from.</p> - string|string[] $to [optional] <p>The string being translated to to.</p>, (*871)

Return: - string <p>This function returns a copy of str, translating all occurrences of each character in "from" to the corresponding character in "to".</p>, (*872)


strwidth(string $str, string $encoding, bool $clean_utf8): int

↑ Return the width of a string., (*873)

INFO: use UTF8::strlen() for the byte-length, (*874)

EXAMPLE: UTF8::strwidth("IùtÍrnâtiôn\xE9àlizÌtiøn")); // 21, (*875)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*876)

Return: - int, (*877)


substr(string $str, int $offset, int|null $length, string $encoding, bool $clean_utf8): false|string

↑ Get part of a string., (*878)

EXAMPLE: UTF8::substr('中文空白', 1, 2); // '文空', (*879)

Parameters: - string $str <p>The string being checked.</p> - int $offset <p>The first position used in str.</p> - int|null $length [optional] <p>The maximum length of the returned string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*880)

Return: - false|string The portion of <i>str</i> specified by the <i>offset</i> and <i>length</i> parameters.</p><p>If <i>str</i> is shorter than <i>offset</i> characters long, <b>FALSE</b> will be returned., (*881)


substr_compare(string $str1, string $str2, int $offset, int|null $length, bool $case_insensitivity, string $encoding): int

↑ Binary-safe comparison of two strings from an offset, up to a length of characters., (*882)

EXAMPLE: UTF8::substr_compare("○●◎\r", '●◎', 0, 2); // -1 UTF8::substr_compare("○●◎\r", '◎●', 1, 2); // 1 UTF8::substr_compare("○●◎\r", '●◎', 1, 2); // 0 , (*883)

Parameters: - string $str1 <p>The main string being compared.</p> - string $str2 <p>The secondary string being compared.</p> - int $offset [optional] <p>The start position for the comparison. If negative, it starts counting from the end of the string.</p> - int|null $length [optional] <p>The length of the comparison. The default value is the largest of the length of the str compared to the length of main_str less the offset.</p> - bool $case_insensitivity [optional] <p>If case_insensitivity is TRUE, comparison is case insensitive.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*884)

Return: - int <strong>&lt; 0</strong> if str1 is less than str2;<br> <strong>&gt; 0</strong> if str1 is greater than str2,<br> <strong>0</strong> if they are equal, (*885)


substr_count(string $haystack, string $needle, int $offset, int|null $length, string $encoding, bool $clean_utf8): false|int

↑ Count the number of substring occurrences., (*886)

EXAMPLE: UTF8::substr_count('中文空白', '文空', 1, 2); // 1, (*887)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p> - int $offset [optional] <p>The offset where to start counting.</p> - int|null $length [optional] <p> The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is greater than the haystack length. </p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*888)

Return: - false|int <p>This functions returns an integer or false if there isn't a string.</p>, (*889)


substr_count_in_byte(string $haystack, string $needle, int $offset, int|null $length): false|int

↑ Count the number of substring occurrences., (*890)

Parameters: - string $haystack <p> The string being checked. </p> - string $needle <p> The string being found. </p> - int $offset [optional] <p> The offset where to start counting </p> - int|null $length [optional] <p> The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is greater than the haystack length. </p>, (*891)

Return: - false|int <p>The number of times the needle substring occurs in the haystack string.</p>, (*892)


substr_count_simple(string $str, string $substring, bool $case_sensitive, string $encoding): int

↑ Returns the number of occurrences of $substring in the given string., (*893)

By default, the comparison is case-sensitive, but can be made insensitive by setting $case_sensitive to false., (*894)

Parameters: - string $str <p>The input string.</p> - string $substring <p>The substring to search for.</p> - bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*895)

Return: - int, (*896)


substr_ileft(string $haystack, string $needle): string

↑ Removes a prefix ($needle) from the beginning of the string ($haystack), case-insensitive., (*897)

EXMAPLE: UTF8::substr_ileft('ΚόσμεMiddleEnd', 'Κόσμε'); // 'MiddleEnd' UTF8::substr_ileft('ΚόσμεMiddleEnd', 'κόσμε'); // 'MiddleEnd' , (*898)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*899)

Return: - string <p>Return the sub-string.</p>, (*900)


substr_in_byte(string $str, int $offset, int|null $length): false|string

↑ Get part of a string process in bytes., (*901)

Parameters: - string $str <p>The string being checked.</p> - int $offset <p>The first position used in str.</p> - int|null $length [optional] <p>The maximum length of the returned string.</p>, (*902)

Return: - false|string <p>The portion of <i>str</i> specified by the <i>offset</i> and <i>length</i> parameters.</p><p>If <i>str</i> is shorter than <i>offset</i> characters long, <b>FALSE</b> will be returned.</p>, (*903)


substr_iright(string $haystack, string $needle): string

↑ Removes a suffix ($needle) from the end of the string ($haystack), case-insensitive., (*904)

EXAMPLE: UTF8::substr_iright('BeginMiddleΚόσμε', 'Κόσμε'); // 'BeginMiddle' UTF8::substr_iright('BeginMiddleΚόσμε', 'κόσμε'); // 'BeginMiddle' , (*905)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*906)

Return: - string <p>Return the sub-string.<p>, (*907)


substr_left(string $haystack, string $needle): string

↑ Removes a prefix ($needle) from the beginning of the string ($haystack)., (*908)

EXAMPLE: UTF8::substr_left('ΚόσμεMiddleEnd', 'Κόσμε'); // 'MiddleEnd' UTF8::substr_left('ΚόσμεMiddleEnd', 'κόσμε'); // 'ΚόσμεMiddleEnd' , (*909)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p>, (*910)

Return: - string <p>Return the sub-string.</p>, (*911)


substr_replace(string|string[] $str, string|string[] $replacement, int|int[] $offset, int|int[]|null $length, string $encoding): string|string[]

↑ Replace text within a portion of a string., (*912)

EXAMPLE: UTF8::substr_replace(array('IùtÍrnâtiônàlizÌtiøn', 'foo'), 'Ì', 1); // array('IÌùtÍrnâtiônàlizÌtiøn', 'fÌoo'), (*913)

source: https://gist.github.com/stemar/8287074, (*914)

Parameters: - TSubReplace $str <p>The input string or an array of stings.</p> - string|string[] $replacement <p>The replacement string or an array of stings.</p> - int|int[] $offset <p> If start is positive, the replacing will begin at the start'th offset into string. <br><br> If start is negative, the replacing will begin at the start'th character from the end of string. </p> - int|int[]|null $length [optional] <p>If given and is positive, it represents the length of the portion of string which is to be replaced. If it is negative, it represents the number of characters from the end of string at which to stop replacing. If it is not given, then it will default to strlen( string ); i.e. end the replacing at the end of string. Of course, if length is zero then this function will have the effect of inserting replacement into string at the given start offset.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*915)

Return: - string|string[] <p>The result string is returned. If string is an array then array is returned.</p>, (*916)


substr_right(string $haystack, string $needle, string $encoding): string

↑ Removes a suffix ($needle) from the end of the string ($haystack)., (*917)

EXAMPLE: UTF8::substr_right('BeginMiddleΚόσμε', 'Κόσμε'); // 'BeginMiddle' UTF8::substr_right('BeginMiddleΚόσμε', 'κόσμε'); // 'BeginMiddleΚόσμε' , (*918)

Parameters: - string $haystack <p>The string to search in.</p> - string $needle <p>The substring to search for.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p>, (*919)

Return: - string <p>Return the sub-string.</p>, (*920)


swapCase(string $str, string $encoding, bool $clean_utf8): string

↑ Returns a case swapped version of the string., (*921)

EXAMPLE: UTF8::swapCase('déJÀ σσς iıII'); // 'DÉjà ΣΣΣ IIii', (*922)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*923)

Return: - string <p>Each character's case swapped.</p>, (*924)


symfony_polyfill_used(): bool

↑ Checks whether symfony-polyfills are used., (*925)

Parameters: nothing, (*926)

Return: - bool <p><strong>true</strong> if in use, <strong>false</strong> otherwise</p>, (*927)


tabs_to_spaces(string $str, int $tab_length): string

↑, (*928)

Parameters: - string $str - int $tab_length, (*929)

Return: - string, (*930)


titlecase(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Converts the first character of each word in the string to uppercase and all other chars to lowercase., (*931)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*932)

Return: - string <p>A string with all characters of $str being title-cased.</p>, (*933)


to_ascii(string $str, string $unknown, bool $strict): string

↑ Convert a string into ASCII., (*934)

EXAMPLE: UTF8::to_ascii('déjà σσς iıii'); // 'deja sss iiii', (*935)

Parameters: - string $str <p>The input string.</p> - string $unknown [optional] <p>Character use if character unknown. (default is ?)</p> - bool $strict [optional] <p>Use "transliterator_transliterate()" from PHP-Intl | WARNING: bad performance</p>, (*936)

Return: - string, (*937)


to_boolean(bool|float|int|string $str): bool

↑, (*938)

Parameters: - bool|float|int|string $str, (*939)

Return: - bool, (*940)


to_filename(string $str, bool $use_transliterate, string $fallback_char): string

↑ Convert given string to safe filename (and keep string case)., (*941)

Parameters: - string $str - bool $use_transliterate No transliteration, conversion etc. is done by default - unsafe characters are simply replaced with hyphen. - string $fallback_char, (*942)

Return: - string, (*943)


to_int(string $str): int|null

↑ Returns the given string as an integer, or null if the string isn't numeric., (*944)

Parameters: - string $str, (*945)

Return: - int|null <p>null if the string isn't numeric</p>, (*946)


to_iso8859(string|string[] $str): string|string[]

↑ Convert a string into "ISO-8859"-encoding (Latin-1)., (*947)

EXAMPLE: UTF8::to_utf8(UTF8::to_iso8859(' -ABC-中文空白- ')); // ' -ABC-????- ', (*948)

Parameters: - TToIso8859 $str, (*949)

Return: - string|string[], (*950)


to_string(float|int|object|string|null $input): string|null

↑ Returns the given input as string, or null if the input isn't int|float|string and do not implement the "__toString()" method., (*951)

Parameters: - float|int|object|string|null $input, (*952)

Return: - string|null <p>null if the input isn't int|float|string and has no "__toString()" method</p>, (*953)


to_utf8(string|string[] $str, bool $decode_html_entity_to_utf8): string|string[]

↑ This function leaves UTF-8 characters alone, while converting almost all non-UTF8 to UTF8., (*954)

  • It decode UTF-8 codepoints and Unicode escape sequences.
  • It assumes that the encoding of the original string is either WINDOWS-1252 or ISO-8859.
  • WARNING: It does not remove invalid UTF-8 characters, so you maybe need to use "UTF8::clean()" for this case.

EXAMPLE: UTF8::to_utf8(["\u0063\u0061\u0074"]); // array('cat'), (*955)

Parameters: - TToUtf8 $str <p>Any string or array of strings.</p> - bool $decode_html_entity_to_utf8 <p>Set to true, if you need to decode html-entities.</p>, (*956)

Return: - string|string[] <p>The UTF-8 encoded string</p>, (*957)


to_utf8_string(string $str, bool $decode_html_entity_to_utf8): string

↑ This function leaves UTF-8 characters alone, while converting almost all non-UTF8 to UTF8., (*958)

  • It decode UTF-8 codepoints and Unicode escape sequences.
  • It assumes that the encoding of the original string is either WINDOWS-1252 or ISO-8859.
  • WARNING: It does not remove invalid UTF-8 characters, so you maybe need to use "UTF8::clean()" for this case.

EXAMPLE: UTF8::to_utf8_string("\u0063\u0061\u0074"); // 'cat', (*959)

Parameters: - T $str <p>Any string.</p> - bool $decode_html_entity_to_utf8 <p>Set to true, if you need to decode html-entities.</p>, (*960)

Return: - string <p>The UTF-8 encoded string</p>, (*961)


trim(string $str, string|null $chars): string

↑ Strip whitespace or other characters from the beginning and end of a UTF-8 string., (*962)

INFO: This is slower then "trim()", (*963)

We can only use the original-function, if we use <= 7-Bit in the string / chars but the check for ASCII (7-Bit) cost more time, then we can safe here., (*964)

EXAMPLE: UTF8::trim(' -ABC-中文空白- '); // '-ABC-中文空白-', (*965)

Parameters: - string $str <p>The string to be trimmed</p> - string|null $chars [optional] <p>Optional characters to be stripped</p>, (*966)

Return: - string <p>The trimmed string.</p>, (*967)


ucfirst(string $str, string $encoding, bool $clean_utf8, string|null $lang, bool $try_to_keep_the_string_length): string

↑ Makes string's first char uppercase., (*968)

EXAMPLE: UTF8::ucfirst('ñtërnâtiônàlizætiøn foo'); // 'Ñtërnâtiônàlizætiøn foo', (*969)

Parameters: - string $str <p>The input string.</p> - string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> - string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> - bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> ß</p>, (*970)

Return: - string <p>The resulting string with with char uppercase.</p>, (*971)


ucwords(string $str, string[] $exceptions, string $char_list, string $encoding, bool $clean_utf8): string

↑ Uppercase for all words in the string., (*972)

EXAMPLE: UTF8::ucwords('iñt ërn âTi ônà liz æti øn'); // 'Iñt Ërn ÂTi Ônà Liz Æti Øn', (*973)

Parameters: - string $str <p>The input string.</p> - string[] $exceptions [optional] <p>Exclusion for some words.</p> - string $char_list [optional] <p>Additional chars that contains to words and do not start a new word.</p> - string $encoding [optional] <p>Set the charset.</p> - bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p>, (*974)

Return: - string, (*975)


urldecode(string $str, bool $multi_decode): string

↑ Multi decode HTML entity + fix urlencoded-win1252-chars., (*976)

EXAMPLE: UTF8::urldecode('tes%20Üäß%20\u00edtest+test'); // 'tes Üäß ítest test', (*977)

e.g: 'test+test' => 'test test' 'Dßsseldorf' => 'Dßsseldorf' 'D%FCsseldorf' => 'Dßsseldorf' 'Dßsseldorf' => 'Dßsseldorf' 'D%26%23xFC%3Bsseldorf' => 'Dßsseldorf' 'Dßsseldorf' => 'Dßsseldorf' 'D%C3%BCsseldorf' => 'Dßsseldorf' 'D%C3%83%C2%BCsseldorf' => 'Dßsseldorf' 'D%25C3%2583%25C2%25BCsseldorf' => 'Dßsseldorf', (*978)

Parameters: - T $str <p>The input string.</p> - bool $multi_decode <p>Decode as often as possible.</p>, (*979)

Return: - string, (*980)


utf8_decode(string $str, bool $keep_utf8_chars): string

↑ Decodes a UTF-8 string to ISO-8859-1., (*981)

EXAMPLE: UTF8::encode('UTF-8', UTF8::utf8_decode('-ABC-中文空白-')); // '-ABC-????-', (*982)

Parameters: - string $str <p>The input string.</p> - bool $keep_utf8_chars, (*983)

Return: - string, (*984)


utf8_encode(string $str): string

↑ Encodes an ISO-8859-1 string to UTF-8., (*985)

EXAMPLE: UTF8::utf8_decode(UTF8::utf8_encode('-ABC-中文空白-')); // '-ABC-中文空白-', (*986)

Parameters: - string $str <p>The input string.</p>, (*987)

Return: - string, (*988)


whitespace_table(): string[]

↑ Returns an array with all utf8 whitespace characters., (*989)

Parameters: nothing, (*990)

Return: - string[] An array with all known whitespace characters as values and the type of whitespace as keys as defined in above URL, (*991)


words_limit(string $str, int $limit, string $str_add_on): string

↑ Limit the number of words in a string., (*992)

EXAMPLE: UTF8::words_limit('fòô bàř fòô', 2, ''); // 'fòô bàř', (*993)

Parameters: - string $str <p>The input string.</p> - int<1, max> $limit <p>The limit of words as integer.</p> - string $str_add_on <p>Replacement for the striped string.</p>, (*994)

Return: - string, (*995)


wordwrap(string $str, int $width, string $break, bool $cut): string

↑ Wraps a string to a given number of characters, (*996)

EXAMPLE: UTF8::wordwrap('IùtÍrnâtiônàlizÌtiøn', 2, '
', true)); // 'IĂą
tĂŤ
rn
ât
iĂ´
nĂ 
li
zĂŚ
ti
øn'
, (*997)

Parameters: - string $str <p>The input string.</p> - int<1, max> $width [optional] <p>The column width.</p> - string $break [optional] <p>The line is broken using the optional break parameter.</p> - bool $cut [optional] <p> If the cut is set to true, the string is always wrapped at or before the specified width. So if you have a word that is larger than the given width, it is broken apart. </p>, (*998)

Return: - string <p>The given string wrapped at the specified column.</p>, (*999)


wordwrap_per_line(string $str, int $width, string $break, bool $cut, bool $add_final_break, string|null $delimiter): string

↑ Line-Wrap the string after $limit, but split the string by "$delimiter" before ... ... so that we wrap the per line., (*1000)

Parameters: - string $str <p>The input string.</p> - int<1, max> $width [optional] <p>The column width.</p> - string $break [optional] <p>The line is broken using the optional break parameter.</p> - bool $cut [optional] <p> If the cut is set to true, the string is always wrapped at or before the specified width. So if you have a word that is larger than the given width, it is broken apart. </p> - bool $add_final_break [optional] <p> If this flag is true, then the method will add a $break at the end of the result string. </p> - non-empty-string|null $delimiter [optional] <p> You can change the default behavior, where we split the string by newline. </p>, (*1001)

Return: - string, (*1002)


ws(): string[]

↑ Returns an array of Unicode White Space characters., (*1003)

Parameters: nothing, (*1004)

Return: - string[] <p>An array with numeric code point as key and White Space Character as value.</p>, (*1005)


Unit Test

1) Composer is a prerequisite for running the tests., (*1006)

composer install

2) The tests can be executed by running this command from the root directory:, (*1007)

./vendor/bin/phpunit

Support

For support and donations please visit GitHub | Issues | PayPal | Patreon., (*1008)

For status updates and release announcements please visit Releases | Twitter | Patreon., (*1009)

For professional support please contact me., (*1010)

Thanks

  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Management, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continuous integration tool out there!
  • Thanks to StyleCI for the simple but powerful code style check.
  • Thanks to PHPStan && Psalm for really great Static analysis tools and for discovering bugs in the code!

"Portable UTF8" is free software; you can redistribute it and/or modify it under the terms of the (at your option): - Apache License v2.0, or - GNU General Public License v2.0., (*1011)

Unicode handling requires tedious work to be implemented and maintained on the long run. As such, contributions such as unit tests, bug reports, comments or patches licensed under both licenses are really welcomed., (*1012)

FOSSA Status, (*1013)

The Versions

12/06 2018

dev-master

9999999-dev https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/05 2018

5.0.6

5.0.6.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

14/02 2018

5.0.5

5.0.5.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

07/01 2018

5.0.4

5.0.4.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/01 2018

5.0.3

5.0.3.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/01 2018

5.0.2

5.0.2.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

01/01 2018

5.0.1

5.0.1.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

10/12 2017

5.0.0

5.0.0.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/11 2017

4.0.1

4.0.1.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/11 2017

4.0.0

4.0.0.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/11 2017

dev-analysis-XVlGoV

dev-analysis-XVlGoV https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/10 2017

3.1.30

3.1.30.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

08/10 2017

3.1.29

3.1.29.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

06/10 2017

3.1.28

3.1.28.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

05/10 2017

dev-analysis-zRdBM7

dev-analysis-zRdBM7 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

04/10 2017

3.1.27

3.1.27.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

24/09 2017

3.1.26

3.1.26.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

05/08 2017

3.1.25

3.1.25.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

21/07 2017

3.1.24

3.1.24.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/06 2017

3.1.23

3.1.23.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/06 2017

dev-analysis-8PDk3e

dev-analysis-8PDk3e https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/06 2017

3.1.22

3.1.22.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

22/05 2017

3.1.21

3.1.21.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

08/05 2017

3.1.20

3.1.20.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

08/04 2017

3.1.19

3.1.19.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

07/04 2017

3.1.18

3.1.18.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

05/04 2017

3.1.17

3.1.17.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/03 2017

3.1.16

3.1.16.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/03 2017

3.1.15

3.1.15.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/03 2017

3.1.14

3.1.14.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

08/03 2017

dev-analysis-86LErW

dev-analysis-86LErW https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

01/02 2017

3.1.13

3.1.13.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

23/01 2017

3.1.12

3.1.12.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

12/01 2017

3.1.11

3.1.11.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

03/01 2017

3.1.10

3.1.10.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

27/12 2016

3.1.9

3.1.9.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

24/12 2016

3.1.8

3.1.8.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

06/12 2016

3.1.7

3.1.7.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/12 2016

3.1.6

3.1.6.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/11 2016

3.1.5

3.1.5.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/11 2016

3.1.4

3.1.4.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/10 2016

3.1.3

3.1.3.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

24/10 2016

3.1.2

3.1.2.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

21/10 2016

3.1.1

3.1.1.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

19/10 2016

3.1.0

3.1.0.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/10 2016

3.0.22

3.0.22.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/10 2016

3.0.21

3.0.21.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

11/10 2016

3.0.20

3.0.20.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

10/10 2016

3.0.19

3.0.19.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

10/10 2016

3.0.18

3.0.18.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/10 2016

3.0.17

3.0.17.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

07/10 2016

3.0.16

3.0.16.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

04/10 2016

3.0.15

3.0.15.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

04/10 2016

3.0.14

3.0.14.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

27/09 2016

3.0.13

3.0.13.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

22/09 2016

3.0.12

3.0.12.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

22/09 2016

3.0.11

3.0.11.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

22/09 2016

3.0.10

3.0.10.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

14/09 2016

3.0.9

3.0.9.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

09/09 2016

3.0.8

3.0.8.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

06/09 2016

3.0.7

3.0.7.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

29/08 2016

3.0.6

3.0.6.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

28/08 2016

3.0.5

3.0.5.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

21/08 2016

3.0.4

3.0.4.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

17/08 2016

3.0.3

3.0.3.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

17/08 2016

3.0.2

3.0.2.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

12/08 2016

3.0.1

3.0.1.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

12/08 2016

3.0.0

3.0.0.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

30/06 2016

2.1.24

2.1.24.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

19/06 2016

2.1.23

2.1.23.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

19/06 2016

2.1.22

2.1.22.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

15/06 2016

2.1.21

2.1.21.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

15/06 2016

2.1.20

2.1.20.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

13/06 2016

2.1.19

2.1.19.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

02/06 2016

2.1.18

2.1.18.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

28/05 2016

2.1.17

2.1.17.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

28/05 2016

2.1.16

2.1.16.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

26/05 2016

2.1.15

2.1.15.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

26/05 2016

2.1.14

2.1.14.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

26/05 2016

2.1.13

2.1.13.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

25/05 2016

2.1.12

2.1.12.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

20/05 2016

2.1.11

2.1.11.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

01/05 2016

2.1.10

2.1.10.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

29/04 2016

2.1.9

2.1.9.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

26/04 2016

2.1.8

2.1.8.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

26/04 2016

2.1.7

2.1.7.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

24/04 2016

2.1.6

2.1.6.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

21/04 2016

2.1.5

2.1.5.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

21/04 2016

2.1.4

2.1.4.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

20/04 2016

2.1.3

2.1.3.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

01/04 2016

2.1.2

2.1.2.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

01/04 2016

2.1.1

2.1.1.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

20/03 2016

2.1.0

2.1.0.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

14/03 2016

2.0.8

2.0.8.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

14/03 2016

2.0.7

2.0.7.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

14/03 2016

2.0.6

2.0.6.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

11/03 2016

2.0.5

2.0.5.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

10/03 2016

2.0.4

2.0.4.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

15/02 2016

2.0.3

2.0.3.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf

05/02 2016

2.0.2

2.0.2.0 https://github.com/voku/portable-utf8

Portable UTF-8 library with polyfill / shim for Iconv, Intl, Mbstring, Normalizrer etc.

  Sources   Download

(Apache-2.0 or GPL-2.0)

The Requires

 

The Development Requires

php utf-8 clean unicode utf8 utf