[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 14795 lines (483 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
__construct() X-Ref |
__construct() |
access(string $str, int $pos, string $encoding = 'UTF-8') X-Ref |
Return the character at the specified position: $str[1] like functionality. EXAMPLE: <code>UTF8::access('fòô', 1); // 'ò'</code> param: string $str <p>A UTF-8 string.</p> param: int $pos <p>The position of character to return.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
add_bom_to_string(string $str) X-Ref |
Prepends UTF-8 BOM character to the string and returns the whole string. INFO: If BOM already existed there, the Input string is returned. EXAMPLE: <code>UTF8::add_bom_to_string('fòô'); // "\xEF\xBB\xBF" . 'fòô'</code> param: string $str <p>The input string.</p> return: string |
array_change_key_case(array $array,int $case = \CASE_LOWER,string $encoding = 'UTF-8') X-Ref |
Changes all keys in an array. param: array<string, mixed> $array <p>The array to work on</p> param: int $case [optional] <p> Either <strong>CASE_UPPER</strong><br> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string[] |
between(string $str,string $start,string $end,int $offset = 0,string $encoding = 'UTF-8') X-Ref |
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. param: string $str param: string $start <p>Delimiter marking the start of the substring.</p> param: string $end <p>Delimiter marking the end of the substring.</p> param: int $offset [optional] <p>Index from which to begin the search. Default: 0</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
binary_to_str($bin) X-Ref |
Convert binary into a string. INFO: opposite to UTF8::str_to_binary() EXAMPLE: <code>UTF8::binary_to_str('11110000100111111001100010000011'); // '😃'</code> param: string $bin 1|0 return: string |
bom() X-Ref |
Returns the UTF-8 Byte Order Mark Character. INFO: take a look at UTF8::$bom for e.g. UTF-16 and UTF-32 BOM values EXAMPLE: <code>UTF8::bom(); // "\xEF\xBB\xBF"</code> return: string |
callback($callback, string $str) X-Ref |
param: callable $callback param: string $str return: string[] |
char_at(string $str, int $index, string $encoding = 'UTF-8') X-Ref |
Returns the character at $index, with indexes starting at 0. param: string $str <p>The input string.</p> param: int $index <p>Position of the character.</p> param: string $encoding [optional] <p>Default is UTF-8</p> return: string |
chars(string $str) X-Ref |
Returns an array consisting of the characters in the string. param: string $str <p>The input string.</p> return: string[] |
checkForSupport() X-Ref |
This method will auto-detect your server environment for UTF-8 support. return: true|null |
chr($code_point, string $encoding = 'UTF-8') X-Ref |
Generates a UTF-8 encoded character from the given code point. INFO: opposite to UTF8::ord() EXAMPLE: <code>UTF8::chr(0x2603); // '☃'</code> param: int $code_point <p>The code point for which to generate a character.</p> param: string $encoding [optional] <p>Default is UTF-8</p> return: string|null |
chr_map($callback, string $str) X-Ref |
Applies callback to all characters of a string. EXAMPLE: <code>UTF8::chr_map([UTF8::class, 'strtolower'], 'Κόσμε'); // ['κ','ό', 'σ', 'μ', 'ε']</code> param: callable $callback <p>The callback function.</p> param: string $str <p>UTF-8 string to run callback on.</p> return: string[] |
chr_size_list(string $str) X-Ref |
Generates an array of byte length of each character of a Unicode string. 1 byte => U+0000 - U+007F 2 byte => U+0080 - U+07FF 3 byte => U+0800 - U+FFFF 4 byte => U+10000 - U+10FFFF EXAMPLE: <code>UTF8::chr_size_list('中文空白-test'); // [3, 3, 3, 3, 1, 1, 1, 1, 1]</code> param: string $str <p>The original unicode string.</p> return: int[] |
chr_to_decimal(string $char) X-Ref |
No description |
chr_to_hex($char, string $prefix = 'U+') X-Ref |
Get hexadecimal code point (U+xxxx) of a UTF-8 encoded character. EXAMPLE: <code>UTF8::chr_to_hex('§'); // U+00a7</code> param: int|string $char <p>The input character</p> param: string $prefix [optional] return: string |
chr_to_int(string $chr) X-Ref |
alias for "UTF8::chr_to_decimal()" param: string $chr return: int |
chunk_split(string $body, int $chunk_length = 76, string $end = "\r\n") X-Ref |
Splits a string into smaller chunks and multiple lines, using the specified line ending character. EXAMPLE: <code>UTF8::chunk_split('ABC-ÖÄÜ-中文空白-κόσμε', 3); // "ABC\r\n-ÖÄ\r\nÜ-中\r\n文空白\r\n-κό\r\nσμε"</code> param: string $body <p>The original string to be split.</p> param: int $chunk_length [optional] <p>The maximum character length of a chunk.</p> param: string $end [optional] <p>The character(s) to be inserted at the end of each chunk.</p> return: string |
clean(string $str,bool $remove_bom = false,bool $normalize_whitespace = false,bool $normalize_msword = false,bool $keep_non_breaking_space = false,bool $replace_diamond_question_mark = false,bool $remove_invisible_characters = true,bool $remove_invisible_characters_url_encoded = false) X-Ref |
Accepts a string and removes all non-UTF-8 characters from it + extras if needed. EXAMPLE: <code>UTF8::clean("\xEF\xBB\xBF„Abcdef\xc2\xa0\x20…” — 😃 - Düsseldorf", true, true); // '„Abcdef …” — 😃 - Düsseldorf'</code> param: string $str <p>The string to be sanitized.</p> param: bool $remove_bom [optional] <p>Set to true, if you need to remove param: bool $normalize_whitespace [optional] <p>Set to true, if you need to normalize the param: bool $normalize_msword [optional] <p>Set to true, if you need to normalize MS param: bool $keep_non_breaking_space [optional] <p>Set to true, to keep non-breaking-spaces, param: bool $replace_diamond_question_mark [optional] <p>Set to true, if you need to remove diamond param: bool $remove_invisible_characters [optional] <p>Set to false, if you not want to remove param: bool $remove_invisible_characters_url_encoded [optional] <p>Set to true, if you not want to remove return: string |
cleanup($str) X-Ref |
Clean-up a string and show only printable UTF-8 chars at the end + fix UTF-8 encoding. EXAMPLE: <code>UTF8::cleanup("\xEF\xBB\xBF„Abcdef\xc2\xa0\x20…” — 😃 - Düsseldorf", true, true); // '„Abcdef …” — 😃 - Düsseldorf'</code> param: string $str <p>The input string.</p> return: string |
codepoints($arg, bool $use_u_style = false) X-Ref |
Accepts a string or a array of strings and returns an array of Unicode code points. INFO: opposite to UTF8::string() EXAMPLE: <code> UTF8::codepoints('κöñ'); // array(954, 246, 241) // ... OR ... UTF8::codepoints('κöñ', true); // array('U+03ba', 'U+00f6', 'U+00f1') </code> param: string|string[] $arg <p>A UTF-8 encoded string or an array of such strings.</p> param: bool $use_u_style <p>If True, will return code points in U+xxxx format, return: int[]|string[] |
collapse_whitespace(string $str) X-Ref |
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. param: string $str <p>The input string.</p> return: string |
count_chars(string $str,bool $clean_utf8 = false,bool $try_to_use_mb_functions = true) X-Ref |
Returns count of characters used in a string. EXAMPLE: <code>UTF8::count_chars('κaκbκc'); // array('κ' => 3, 'a' => 1, 'b' => 1, 'c' => 1)</code> param: string $str <p>The input string.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use return: int[] |
css_identifier(string $str = '',array $filter = [' ' => '-','/' => '-','[' => '',']' => '',],bool $strip_tags = false,bool $strtolower = true) X-Ref |
Create a valid CSS identifier for e.g. "class"- or "id"-attributes. EXAMPLE: <code>UTF8::css_identifier('123foo/bar!!!'); // _23foo-bar</code> copy&past from https://github.com/drupal/core/blob/8.8.x/lib/Drupal/Component/Utility/Html.php#L95 param: string $str <p>INFO: if no identifier is given e.g. " " or "", we will create a unique string automatically</p> param: string[] $filter param: bool $strip_tags param: bool $strtolower return: string |
css_stripe_media_queries(string $str) X-Ref |
Remove css media-queries. param: string $str return: string |
ctype_loaded() X-Ref |
Checks whether ctype is available on the server. return: bool |
decimal_to_chr($int) X-Ref |
Converts an int value into a UTF-8 character. INFO: opposite to UTF8::string() EXAMPLE: <code>UTF8::decimal_to_chr(931); // 'Σ'</code> param: int|string $int return: string |
decode_mimeheader($str, string $encoding = 'UTF-8') X-Ref |
Decodes a MIME header field param: string $str param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|string |
emoji_from_country_code(string $country_code_iso_3166_1) X-Ref |
Convert any two-letter country code (ISO 3166-1) to the corresponding Emoji. param: string $country_code_iso_3166_1 <p>e.g. DE</p> return: string |
emoji_decode(string $str,bool $use_reversible_string_mappings = false) X-Ref |
Decodes a string which was encoded by "UTF8::emoji_encode()". INFO: opposite to UTF8::emoji_encode() EXAMPLE: <code> UTF8::emoji_decode('foo CHARACTER_OGRE', false); // 'foo 👹' // UTF8::emoji_decode('foo _-_PORTABLE_UTF8_-_308095726_-_627590803_-_8FTU_ELBATROP_-_', true); // 'foo 👹' </code> param: string $str <p>The input string.</p> param: bool $use_reversible_string_mappings [optional] <p> return: string |
emoji_encode(string $str,bool $use_reversible_string_mappings = false) X-Ref |
Encode a string with emoji chars into a non-emoji string. INFO: opposite to UTF8::emoji_decode() EXAMPLE: <code> UTF8::emoji_encode('foo 👹', false)); // 'foo CHARACTER_OGRE' // UTF8::emoji_encode('foo 👹', true)); // 'foo _-_PORTABLE_UTF8_-_308095726_-_627590803_-_8FTU_ELBATROP_-_' </code> param: string $str <p>The input string</p> param: bool $use_reversible_string_mappings [optional] <p> return: string |
encode(string $to_encoding,string $str,bool $auto_detect_the_from_encoding = true,string $from_encoding = '') X-Ref |
Encode a string with a new charset-encoding. 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. EXAMPLE: <code> UTF8::encode('ISO-8859-1', '-ABC-中文空白-'); // '-ABC-????-' // UTF8::encode('UTF-8', '-ABC-中文空白-'); // '-ABC-中文空白-' // UTF8::encode('HTML', '-ABC-中文空白-'); // '-ABC-中文空白-' // UTF8::encode('BASE64', '-ABC-中文空白-'); // 'LUFCQy3kuK3mlofnqbrnmb0t' </code> param: string $to_encoding <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.</p> param: string $str <p>The input string</p> param: bool $auto_detect_the_from_encoding [optional] <p>Force the new encoding (we try to fix broken / double param: string $from_encoding [optional] <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.<br> return: string |
encode_mimeheader(string $str,string $from_charset = 'UTF-8',string $to_charset = 'UTF-8',string $transfer_encoding = 'Q',string $linefeed = "\r\n",int $indent = 76) X-Ref |
param: string $str param: string $from_charset [optional] <p>Set the input charset.</p> param: string $to_charset [optional] <p>Set the output charset.</p> param: string $transfer_encoding [optional] <p>Set the transfer encoding.</p> param: string $linefeed [optional] <p>Set the used linefeed.</p> param: int $indent [optional] <p>Set the max length indent.</p> return: false|string |
extract_text(string $str,string $search = '',int $length = null,string $replacer_for_skipped_text = '…',string $encoding = 'UTF-8') X-Ref |
Create an extract from a sentence, so if the search-string was found, it try to centered in the output. param: string $str <p>The input string.</p> param: string $search <p>The searched string.</p> param: int|null $length [optional] <p>Default: null === text->length / 2</p> param: string $replacer_for_skipped_text [optional] <p>Default: …</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
file_get_contents(string $filename,bool $use_include_path = false,$context = null,int $offset = null,int $max_length = null,int $timeout = 10,bool $convert_to_utf8 = true,string $from_encoding = '') X-Ref |
Reads entire file into a string. EXAMPLE: <code>UTF8::file_get_contents('utf16le.txt'); // ...</code> WARNING: Do not use UTF-8 Option ($convert_to_utf8) for binary files (e.g.: images) !!! param: string $filename <p> param: bool $use_include_path [optional] <p> param: resource|null $context [optional] <p> param: int|null $offset [optional] <p> param: int|null $max_length [optional] <p> param: int $timeout <p>The time in seconds for the timeout.</p> param: bool $convert_to_utf8 <strong>WARNING!!!</strong> <p>Maybe you can't use this option for param: string $from_encoding [optional] <p>e.g. 'UTF-16', 'UTF-8', 'ISO-8859-1', etc.<br> return: false|string |
file_has_bom(string $file_path) X-Ref |
Checks if a file starts with BOM (Byte Order Mark) character. EXAMPLE: <code>UTF8::file_has_bom('utf8_with_bom.txt'); // true</code> param: string $file_path <p>Path to a valid file.</p> return: bool |
filter($var,int $normalization_form = \Normalizer::NFC,string $leading_combining = '◌') X-Ref |
Normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. EXAMPLE: <code>UTF8::filter(array("\xE9", 'à', 'a')); // array('é', 'à', 'a')</code> param: array|object|string $var param: int $normalization_form param: string $leading_combining return: mixed |
filter_input(int $type,string $variable_name,int $filter = \FILTER_DEFAULT,$options = null) X-Ref |
"filter_input()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. Gets a specific external variable by name and optionally filters it. EXAMPLE: <code> // _GET['foo'] = 'bar'; UTF8::filter_input(INPUT_GET, 'foo', FILTER_SANITIZE_STRING)); // 'bar' </code> param: int $type <p> param: string $variable_name <p> param: int $filter [optional] <p> param: int|int[]|null $options [optional] <p> return: mixed |
filter_input_array(int $type,$definition = null,bool $add_empty = true) X-Ref |
"filter_input_array()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. Gets external variables and optionally filters them. EXAMPLE: <code> // _GET['foo'] = 'bar'; UTF8::filter_input_array(INPUT_GET, array('foo' => 'FILTER_SANITIZE_STRING')); // array('bar') </code> param: int $type <p> param: array|null $definition [optional] <p> param: bool $add_empty [optional] <p> return: mixed |
filter_var($variable,int $filter = \FILTER_DEFAULT,$options = null) X-Ref |
"filter_var()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. Filters a variable with a specified filter. EXAMPLE: <code>UTF8::filter_var('-ABC-中文空白-', FILTER_VALIDATE_URL); // false</code> param: float|int|string|null $variable <p> param: int $filter [optional] <p> param: int|int[]|null $options [optional] <p> return: mixed |
filter_var_array(array $data,$definition = null,bool $add_empty = true) X-Ref |
"filter_var_array()"-wrapper with normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. Gets multiple variables and optionally filters them. EXAMPLE: <code> $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, ]; $data = [ 'name' => 'κόσμε', 'age' => '18', 'email' => '[email protected]' ]; UTF8::filter_var_array($data, $filters, true); // ['name' => 'Κόσμε', 'age' => 18, 'email' => '[email protected]'] </code> param: array<mixed> $data <p> param: array|int|null $definition [optional] <p> param: bool $add_empty [optional] <p> return: mixed |
finfo_loaded() X-Ref |
Checks whether finfo is available on the server. return: bool |
first_char(string $str,int $n = 1,string $encoding = 'UTF-8') X-Ref |
Returns the first $n characters of the string. param: string $str <p>The input string.</p> param: int $n <p>Number of characters to retrieve from the start.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
fits_inside(string $str, int $box_size) X-Ref |
Check if the number of Unicode characters isn't greater than the specified integer. EXAMPLE: <code>UTF8::fits_inside('κόσμε', 6); // false</code> param: string $str the original string to be checked param: int $box_size the size in number of chars to be checked against string return: bool |
fix_simple_utf8(string $str) X-Ref |
Try to fix simple broken UTF-8 strings. INFO: Take a look at "UTF8::fix_utf8()" if you need a more advanced fix for broken UTF-8 strings. EXAMPLE: <code>UTF8::fix_simple_utf8('Düsseldorf'); // 'Düsseldorf'</code> 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 param: string $str <p>The input string</p> return: string |
fix_utf8($str) X-Ref |
Fix a double (or multiple) encoded UTF8 string. EXAMPLE: <code>UTF8::fix_utf8('Fédération'); // 'Fédération'</code> param: string|string[] $str you can use a string or an array of strings return: string|string[] |
getCharDirection(string $char) X-Ref |
Get character of a specific character. EXAMPLE: <code>UTF8::getCharDirection('ا'); // 'RTL'</code> param: string $char return: string |
getSupportInfo(string $key = null) X-Ref |
Check for php-support. param: string|null $key return: mixed |
get_file_type(string $str,array $fallback = ['ext' => null,'mime' => 'application/octet-stream','type' => null,]) X-Ref |
Warning: this method only works for some file-types (png, jpg) if you need more supported types, please use e.g. "finfo" param: string $str param: array $fallback <p>with this keys: 'ext', 'mime', 'type' return: null[]|string[] |
get_random_string(int $length,string $possible_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',string $encoding = 'UTF-8') X-Ref |
param: int $length <p>Length of the random string.</p> param: string $possible_chars [optional] <p>Characters string for the random selection.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
get_unique_string($extra_entropy = '', bool $use_md5 = true) X-Ref |
param: int|string $extra_entropy [optional] <p>Extra entropy via a string or int value.</p> param: bool $use_md5 [optional] <p>Return the unique identifier as md5-hash? Default: true</p> return: string |
hasBom(string $str) X-Ref |
alias for "UTF8::string_has_bom()" param: string $str return: bool |
has_lowercase(string $str) X-Ref |
Returns true if the string contains a lower case char, false otherwise. param: string $str <p>The input string.</p> return: bool |
has_whitespace(string $str) X-Ref |
Returns true if the string contains whitespace, false otherwise. param: string $str <p>The input string.</p> return: bool |
has_uppercase(string $str) X-Ref |
Returns true if the string contains an upper case char, false otherwise. param: string $str <p>The input string.</p> return: bool |
hex_to_chr(string $hexdec) X-Ref |
Converts a hexadecimal value into a UTF-8 character. INFO: opposite to UTF8::chr_to_hex() EXAMPLE: <code>UTF8::hex_to_chr('U+00a7'); // '§'</code> param: string $hexdec <p>The hexadecimal value.</p> return: false|string one single UTF-8 character |
hex_to_int($hexdec) X-Ref |
Converts hexadecimal U+xxxx code point representation to integer. INFO: opposite to UTF8::int_to_hex() EXAMPLE: <code>UTF8::hex_to_int('U+00f1'); // 241</code> param: string $hexdec <p>The hexadecimal code point representation.</p> return: false|int |
html_decode(string $str,int $flags = null,string $encoding = 'UTF-8') X-Ref |
alias for "UTF8::html_entity_decode()" param: string $str param: int|null $flags param: string $encoding return: string |
html_encode(string $str,bool $keep_ascii_chars = false,string $encoding = 'UTF-8') X-Ref |
Converts a UTF-8 string to a series of HTML numbered entities. INFO: opposite to UTF8::html_decode() EXAMPLE: <code>UTF8::html_encode('中文空白'); // '中文空白'</code> param: string $str <p>The Unicode string to be encoded as numbered entities.</p> param: bool $keep_ascii_chars [optional] <p>Keep ASCII chars.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string HTML numbered entities |
html_entity_decode(string $str,int $flags = null,string $encoding = 'UTF-8') X-Ref |
No description |
html_escape(string $str, string $encoding = 'UTF-8') X-Ref |
Create a escape html version of the string via "UTF8::htmlspecialchars()". param: string $str param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
html_stripe_empty_tags(string $str) X-Ref |
Remove empty html-tag. e.g.: <pre><tag></tag></pre> param: string $str return: string |
htmlentities(string $str,int $flags = \ENT_COMPAT,string $encoding = 'UTF-8',bool $double_encode = true) X-Ref |
Convert all applicable characters to HTML entities: UTF-8 version of htmlentities(). EXAMPLE: <code>UTF8::htmlentities('<白-öäü>'); // '<白-öäü>'</code> param: string $str <p> param: int $flags [optional] <p> param: string $encoding [optional] <p> param: bool $double_encode [optional] <p> return: string |
htmlspecialchars(string $str,int $flags = \ENT_COMPAT,string $encoding = 'UTF-8',bool $double_encode = true) X-Ref |
Convert only special characters to HTML entities: UTF-8 version of htmlspecialchars() INFO: Take a look at "UTF8::htmlentities()" EXAMPLE: <code>UTF8::htmlspecialchars('<白-öäü>'); // '<白-öäü>'</code> param: string $str <p> param: int $flags [optional] <p> param: string $encoding [optional] <p> param: bool $double_encode [optional] <p> return: string the converted string. |
iconv_loaded() X-Ref |
Checks whether iconv is available on the server. return: bool |
int_to_chr($int) X-Ref |
alias for "UTF8::decimal_to_chr()" param: int|string $int return: string |
int_to_hex(int $int, string $prefix = 'U+') X-Ref |
Converts Integer to hexadecimal U+xxxx code point representation. INFO: opposite to UTF8::hex_to_int() EXAMPLE: <code>UTF8::int_to_hex(241); // 'U+00f1'</code> param: int $int <p>The integer to be converted to hexadecimal code point.</p> param: string $prefix [optional] return: string the code point, or empty string on failure |
intlChar_loaded() X-Ref |
Checks whether intl-char is available on the server. return: bool |
intl_loaded() X-Ref |
Checks whether intl is available on the server. return: bool |
isAscii(string $str) X-Ref |
alias for "UTF8::is_ascii()" param: string $str return: bool |
isBase64($str) X-Ref |
alias for "UTF8::is_base64()" param: string $str return: bool |
isBinary($str, bool $strict = false) X-Ref |
alias for "UTF8::is_binary()" param: int|string $str param: bool $strict return: bool |
isBom(string $utf8_chr) X-Ref |
alias for "UTF8::is_bom()" param: string $utf8_chr return: bool |
isHtml(string $str) X-Ref |
alias for "UTF8::is_html()" param: string $str return: bool |
isJson(string $str) X-Ref |
alias for "UTF8::is_json()" param: string $str return: bool |
isUtf16($str) X-Ref |
alias for "UTF8::is_utf16()" param: string $str return: false|int |
isUtf32($str) X-Ref |
alias for "UTF8::is_utf32()" param: string $str return: false|int |
isUtf8($str, bool $strict = false) X-Ref |
alias for "UTF8::is_utf8()" param: string $str param: bool $strict return: bool |
is_alpha(string $str) X-Ref |
Returns true if the string contains only alphabetic chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_alphanumeric(string $str) X-Ref |
Returns true if the string contains only alphabetic and numeric chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_punctuation(string $str) X-Ref |
Returns true if the string contains only punctuation chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_printable(string $str, bool $ignore_control_characters = false) X-Ref |
Returns true if the string contains only printable (non-invisible) chars, false otherwise. param: string $str <p>The input string.</p> param: bool $ignore_control_characters [optional] <p>Ignore control characters like [LRM] or [LSEP].</p> return: bool |
is_ascii(string $str) X-Ref |
Checks if a string is 7 bit ASCII. EXAMPLE: <code>UTF8::is_ascii('白'); // false</code> param: string $str <p>The string to check.</p> return: bool |
is_base64($str, bool $empty_string_is_valid = false) X-Ref |
Returns true if the string is base64 encoded, false otherwise. EXAMPLE: <code>UTF8::is_base64('4KSu4KWL4KSo4KS/4KSa'); // true</code> param: string|null $str <p>The input string.</p> param: bool $empty_string_is_valid [optional] <p>Is an empty string valid base64 or not?</p> return: bool |
is_binary($input, bool $strict = false) X-Ref |
Check if the input is binary... (is look like a hack). EXAMPLE: <code>UTF8::is_binary(01); // true</code> param: int|string $input param: bool $strict return: bool |
is_binary_file($file) X-Ref |
Check if the file is binary. EXAMPLE: <code>UTF8::is_binary('./utf32.txt'); // true</code> param: string $file return: bool |
is_blank(string $str) X-Ref |
Returns true if the string contains only whitespace chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_bom($str) X-Ref |
Checks if the given string is equal to any "Byte Order Mark". WARNING: Use "UTF8::string_has_bom()" if you will check BOM in a string. EXAMPLE: <code>UTF8::is_bom("\xef\xbb\xbf"); // true</code> param: string $str <p>The input string.</p> return: bool |
is_empty($str) X-Ref |
Determine whether the string is considered to be empty. 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. param: array|float|int|string $str return: bool |
is_hexadecimal(string $str) X-Ref |
Returns true if the string contains only hexadecimal chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_html(string $str) X-Ref |
Check if the string contains any HTML tags. EXAMPLE: <code>UTF8::is_html('<b>lall</b>'); // true</code> param: string $str <p>The input string.</p> return: bool |
is_url(string $url, bool $disallow_localhost = false) X-Ref |
Check if $url is an correct url. param: string $url param: bool $disallow_localhost return: bool |
is_json(string $str, bool $only_array_or_object_results_are_valid = true) X-Ref |
Try to check if "$str" is a JSON-string. EXAMPLE: <code>UTF8::is_json('{"array":[1,"¥","ä"]}'); // true</code> param: string $str <p>The input string.</p> param: bool $only_array_or_object_results_are_valid [optional] <p>Only array and objects are valid json return: bool |
is_lowercase(string $str) X-Ref |
param: string $str <p>The input string.</p> return: bool |
is_serialized(string $str) X-Ref |
Returns true if the string is serialized, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_uppercase(string $str) X-Ref |
Returns true if the string contains only lower case chars, false otherwise. param: string $str <p>The input string.</p> return: bool |
is_utf16($str, bool $check_if_string_is_binary = true) X-Ref |
Check if the string is UTF-16. EXAMPLE: <code> 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 </code> param: string $str <p>The input string.</p> param: bool $check_if_string_is_binary return: false|int |
is_utf32($str, bool $check_if_string_is_binary = true) X-Ref |
Check if the string is UTF-32. EXAMPLE: <code> 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 </code> param: string $str <p>The input string.</p> param: bool $check_if_string_is_binary return: false|int |
is_utf8($str, bool $strict = false) X-Ref |
Checks whether the passed input contains only byte sequences that appear valid UTF-8. EXAMPLE: <code> 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 </code> param: int|string|string[]|null $str <p>The input to be checked.</p> param: bool $strict <p>Check also if the string is not UTF-16 or UTF-32.</p> return: bool |
json_decode(string $json,bool $assoc = false,int $depth = 512,int $options = 0) X-Ref |
(PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> Decodes a JSON string EXAMPLE: <code>UTF8::json_decode('[1,"\u00a5","\u00e4"]'); // array(1, '¥', 'ä')</code> param: string $json <p> param: bool $assoc [optional] <p> param: int $depth [optional] <p> param: int $options [optional] <p> return: mixed |
json_encode($value, int $options = 0, int $depth = 512) X-Ref |
(PHP 5 >= 5.2.0, PECL json >= 1.2.0)<br/> Returns the JSON representation of a value. EXAMPLE: <code>UTF8::json_enocde(array(1, '¥', 'ä')); // '[1,"\u00a5","\u00e4"]'</code> param: mixed $value <p> param: int $options [optional] <p> param: int $depth [optional] <p> return: false|string |
json_loaded() X-Ref |
Checks whether JSON is available on the server. return: bool |
lcfirst(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Makes string's first char lowercase. EXAMPLE: <code>UTF8::lcfirst('ÑTËRNÂTIÔNÀLIZÆTIØN'); // ñTËRNÂTIÔNÀLIZÆTIØN</code> param: string $str <p>The input string</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string the resulting string |
lcword(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
alias for "UTF8::lcfirst()" param: string $str param: string $encoding param: bool $clean_utf8 param: string|null $lang param: bool $try_to_keep_the_string_length return: string |
lcwords(string $str,array $exceptions = [],string $char_list = '',string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Lowercase for all words in the string. param: string $str <p>The input string.</p> param: string[] $exceptions [optional] <p>Exclusion for some words.</p> param: string $char_list [optional] <p>Additional chars that contains to words and do param: string $encoding [optional] <p>Set the charset.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
lowerCaseFirst(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
alias for "UTF8::lcfirst()" param: string $str param: string $encoding param: bool $clean_utf8 param: string|null $lang param: bool $try_to_keep_the_string_length return: string |
ltrim(string $str = '', string $chars = null) X-Ref |
Strip whitespace or other characters from the beginning of a UTF-8 string. EXAMPLE: <code>UTF8::ltrim(' 中文空白 '); // '中文空白 '</code> param: string $str <p>The string to be trimmed</p> param: string|null $chars <p>Optional characters to be stripped</p> return: string the string with unwanted characters stripped from the left |
max($arg) X-Ref |
Returns the UTF-8 character with the maximum code point in the given data. EXAMPLE: <code>UTF8::max('abc-äöü-中文空白'); // 'ø'</code> param: array<string>|string $arg <p>A UTF-8 encoded string or an array of such strings.</p> return: string|null the character with the highest code point than others, returns null on failure or empty input |
max_chr_width(string $str) X-Ref |
Calculates and returns the maximum number of bytes taken by any UTF-8 encoded character in the given string. EXAMPLE: <code>UTF8::max_chr_width('Intërnâtiônàlizætiøn'); // 2</code> param: string $str <p>The original Unicode string.</p> return: int |
mbstring_loaded() X-Ref |
Checks whether mbstring is available on the server. return: bool |
min($arg) X-Ref |
Returns the UTF-8 character with the minimum code point in the given data. EXAMPLE: <code>UTF8::min('abc-äöü-中文空白'); // '-'</code> param: string|string[] $arg <strong>A UTF-8 encoded string or an array of such strings.</strong> return: string|null |
normalizeEncoding($encoding, $fallback = '') X-Ref |
alias for "UTF8::normalize_encoding()" param: mixed $encoding param: mixed $fallback return: mixed |
normalize_encoding($encoding, $fallback = '') X-Ref |
Normalize the encoding-"name" input. EXAMPLE: <code>UTF8::normalize_encoding('UTF8'); // 'UTF-8'</code> param: mixed $encoding <p>e.g.: ISO, UTF8, WINDOWS-1251 etc.</p> param: mixed $fallback <p>e.g.: UTF-8</p> return: mixed|string |
normalize_line_ending(string $str, $replacer = "\n") X-Ref |
Standardize line ending to unix-like. param: string $str <p>The input string.</p> param: string|string[] $replacer <p>The replacer char e.g. "\n" (Linux) or "\r\n" (Windows). You can also use \PHP_EOL return: string |
normalize_msword(string $str) X-Ref |
Normalize some MS Word special characters. EXAMPLE: <code>UTF8::normalize_msword('„Abcdef…”'); // '"Abcdef..."'</code> param: string $str <p>The string to be normalized.</p> return: string |
normalize_whitespace(string $str,bool $keep_non_breaking_space = false,bool $keep_bidi_unicode_controls = false,bool $normalize_control_characters = false) X-Ref |
Normalize the whitespace. EXAMPLE: <code>UTF8::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-öäü- -"</code> param: string $str <p>The string to be normalized.</p> param: bool $keep_non_breaking_space [optional] <p>Set to true, to keep non-breaking-spaces.</p> param: bool $keep_bidi_unicode_controls [optional] <p>Set to true, to keep non-printable (for the web) param: bool $normalize_control_characters [optional] <p>Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p> return: string |
ord($chr, string $encoding = 'UTF-8') X-Ref |
Calculates Unicode code point of the given UTF-8 encoded character. INFO: opposite to UTF8::chr() EXAMPLE: <code>UTF8::ord('☃'); // 0x2603</code> param: string $chr <p>The character of which to calculate code point.<p/> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
parse_str(string $str, &$result, bool $clean_utf8 = false) X-Ref |
Parses the string into an array (into the the second parameter). WARNING: Unlike "parse_str()", this method does not (re-)place variables in the current scope, if the second parameter is not set! EXAMPLE: <code> 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']; // '測試' </code> param: string $str <p>The input string.</p> param: array $result <p>The result will be returned into this reference parameter.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: bool |
pcre_utf8_support() X-Ref |
Checks if \u modifier is available that enables Unicode support in PCRE. return: bool |
range($var1,$var2,bool $use_ctype = true,string $encoding = 'UTF-8',$step = 1) X-Ref |
Create an array containing a range of UTF-8 characters. EXAMPLE: <code>UTF8::range('κ', 'ζ'); // array('κ', 'ι', 'θ', 'η', 'ζ',)</code> param: int|string $var1 <p>Numeric or hexadecimal code points, or a UTF-8 character to start from.</p> param: int|string $var2 <p>Numeric or hexadecimal code points, or a UTF-8 character to end at.</p> param: bool $use_ctype <p>use ctype to detect numeric and hexadecimal, otherwise we will use a simple param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: float|int $step [optional] <p> return: string[] |
rawurldecode(string $str, bool $multi_decode = true) X-Ref |
Multi decode HTML entity + fix urlencoded-win1252-chars. EXAMPLE: <code>UTF8::rawurldecode('tes%20öäü%20\u00edtest+test'); // 'tes öäü ítest+test'</code> 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' param: string $str <p>The input string.</p> param: bool $multi_decode <p>Decode as often as possible.</p> return: string |
regex_replace(string $str,string $pattern,string $replacement,string $options = '',string $delimiter = '/') X-Ref |
Replaces all occurrences of $pattern in $str by $replacement. param: string $str <p>The input string.</p> param: string $pattern <p>The regular expression pattern.</p> param: string $replacement <p>The string to replace with.</p> param: string $options [optional] <p>Matching conditions to be used.</p> param: string $delimiter [optional] <p>Delimiter the the regex. Default: '/'</p> return: string |
removeBOM(string $str) X-Ref |
alias for "UTF8::remove_bom()" param: string $str return: string |
remove_bom(string $str) X-Ref |
Remove the BOM from UTF-8 / UTF-16 / UTF-32 strings. EXAMPLE: <code>UTF8::remove_bom("\xEF\xBB\xBFΜπορώ να"); // 'Μπορώ να'</code> param: string $str <p>The input string.</p> return: string |
remove_duplicates(string $str, $what = ' ') X-Ref |
Removes duplicate occurrences of a string in another string. EXAMPLE: <code>UTF8::remove_duplicates('öäü-κόσμεκόσμε-äöü', 'κόσμε'); // 'öäü-κόσμε-äöü'</code> param: string $str <p>The base string.</p> param: string|string[] $what <p>String to search for in the base string.</p> return: string |
remove_html(string $str, string $allowable_tags = '') X-Ref |
Remove html via "strip_tags()" from the string. param: string $str <p>The input string.</p> param: string $allowable_tags [optional] <p>You can use the optional second parameter to specify tags which return: string |
remove_html_breaks(string $str, string $replacement = '') X-Ref |
Remove all breaks [<br> | \r\n | \r | \n | ...] from the string. param: string $str <p>The input string.</p> param: string $replacement [optional] <p>Default is a empty string.</p> return: string |
remove_invisible_characters(string $str,bool $url_encoded = false,string $replacement = '',bool $keep_basic_control_characters = true) X-Ref |
Remove invisible characters from a string. e.g.: This prevents sandwiching null characters between ascii characters, like Java\0script. EXAMPLE: <code>UTF8::remove_invisible_characters("κόσ\0με"); // 'κόσμε'</code> copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php param: string $str <p>The input string.</p> param: bool $url_encoded [optional] <p> param: string $replacement [optional] <p>The replacement character.</p> param: bool $keep_basic_control_characters [optional] <p>Keep control characters like [LRM] or [LSEP].</p> return: string |
remove_left(string $str,string $substring,string $encoding = 'UTF-8') X-Ref |
Returns a new string with the prefix $substring removed, if present. param: string $str <p>The input string.</p> param: string $substring <p>The prefix to remove.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
remove_right(string $str,string $substring,string $encoding = 'UTF-8') X-Ref |
Returns a new string with the suffix $substring removed, if present. param: string $str param: string $substring <p>The suffix to remove.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
replace(string $str,string $search,string $replacement,bool $case_sensitive = true) X-Ref |
Replaces all occurrences of $search in $str by $replacement. param: string $str <p>The input string.</p> param: string $search <p>The needle to search for.</p> param: string $replacement <p>The string to replace with.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> return: string |
replace_all(string $str,array $search,$replacement,bool $case_sensitive = true) X-Ref |
Replaces all occurrences of $search in $str by $replacement. param: string $str <p>The input string.</p> param: array $search <p>The elements to search for.</p> param: array|string $replacement <p>The string to replace with.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> return: string |
replace_diamond_question_mark(string $str,string $replacement_char = '',bool $process_invalid_utf8_chars = true) X-Ref |
Replace the diamond question mark (�) and invalid-UTF8 chars with the replacement. EXAMPLE: <code>UTF8::replace_diamond_question_mark('中文空白�', ''); // '中文空白'</code> param: string $str <p>The input string</p> param: string $replacement_char <p>The replacement character.</p> param: bool $process_invalid_utf8_chars <p>Convert invalid UTF-8 chars </p> return: string |
rtrim(string $str = '', string $chars = null) X-Ref |
Strip whitespace or other characters from the end of a UTF-8 string. EXAMPLE: <code>UTF8::rtrim('-ABC-中文空白- '); // '-ABC-中文空白-'</code> param: string $str <p>The string to be trimmed.</p> param: string|null $chars <p>Optional characters to be stripped.</p> return: string |
showSupport(bool $useEcho = true) X-Ref |
WARNING: Print native UTF-8 support (libs) by default, e.g. for debugging. param: bool $useEcho return: string|void |
single_chr_html_encode(string $char,bool $keep_ascii_chars = false,string $encoding = 'UTF-8') X-Ref |
Converts a UTF-8 character to HTML Numbered Entity like "{". EXAMPLE: <code>UTF8::single_chr_html_encode('κ'); // 'κ'</code> param: string $char <p>The Unicode character to be encoded as numbered entity.</p> param: bool $keep_ascii_chars <p>Set to <strong>true</strong> to keep ASCII chars.</> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
spaces_to_tabs(string $str, int $tab_length = 4) X-Ref |
param: string $str param: int $tab_length return: string |
split($str,int $length = 1,bool $clean_utf8 = false) X-Ref |
alias for "UTF8::str_split()" param: int|string $str param: int $length param: bool $clean_utf8 return: string[] |
str_begins(string $haystack, string $needle) X-Ref |
alias for "UTF8::str_starts_with()" param: string $haystack param: string $needle return: bool |
str_camelize(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
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. param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
str_capitalize_name(string $str) X-Ref |
param: array $match return: string |
str_contains(string $haystack,string $needle,bool $case_sensitive = true) X-Ref |
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. param: string $haystack <p>The input string.</p> param: string $needle <p>Substring to look for.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> return: bool |
str_contains_all(string $haystack,array $needles,bool $case_sensitive = true) X-Ref |
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. param: string $haystack <p>The input string.</p> param: array $needles <p>SubStrings to look for.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> return: bool |
str_contains_any(string $haystack,array $needles,bool $case_sensitive = true) X-Ref |
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. param: string $haystack <p>The input string.</p> param: array $needles <p>SubStrings to look for.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> return: bool |
str_dasherize(string $str, string $encoding = 'UTF-8') X-Ref |
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. param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_delimit(string $str,string $delimiter,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Returns a lowercase and trimmed string separated by the given delimiter. 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. param: string $str <p>The input string.</p> param: string $delimiter <p>Sequence used to separate parts of the string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ -> return: string |
str_detect_encoding($str) X-Ref |
Optimized "mb_detect_encoding()"-function -> with support for UTF-16 and UTF-32. EXAMPLE: <code> UTF8::str_detect_encoding('中文空白'); // 'UTF-8' UTF8::str_detect_encoding('Abc'); // 'ASCII' </code> param: string $str <p>The input string.</p> return: false|string |
str_ends(string $haystack, string $needle) X-Ref |
alias for "UTF8::str_ends_with()" param: string $haystack param: string $needle return: bool |
str_ends_with(string $haystack, string $needle) X-Ref |
Check if the string ends with the given substring. EXAMPLE: <code> UTF8::str_ends_with('BeginMiddleΚόσμε', 'Κόσμε'); // true UTF8::str_ends_with('BeginMiddleΚόσμε', 'κόσμε'); // false </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: bool |
str_ends_with_any(string $str, array $substrings) X-Ref |
Returns true if the string ends with any of $substrings, false otherwise. - case-sensitive param: string $str <p>The input string.</p> param: string[] $substrings <p>Substrings to look for.</p> return: bool |
str_ensure_left(string $str, string $substring) X-Ref |
Ensures that the string begins with $substring. If it doesn't, it's prepended. param: string $str <p>The input string.</p> param: string $substring <p>The substring to add if not present.</p> return: string |
str_ensure_right(string $str, string $substring) X-Ref |
Ensures that the string ends with $substring. If it doesn't, it's appended. param: string $str <p>The input string.</p> param: string $substring <p>The substring to add if not present.</p> return: string |
str_humanize($str) X-Ref |
Capitalizes the first word of the string, replaces underscores with spaces, and strips '_id'. param: string $str return: string |
str_ibegins(string $haystack, string $needle) X-Ref |
alias for "UTF8::str_istarts_with()" param: string $haystack param: string $needle return: bool |
str_iends(string $haystack, string $needle) X-Ref |
alias for "UTF8::str_iends_with()" param: string $haystack param: string $needle return: bool |
str_iends_with(string $haystack, string $needle) X-Ref |
Check if the string ends with the given substring, case-insensitive. EXAMPLE: <code> UTF8::str_iends_with('BeginMiddleΚόσμε', 'Κόσμε'); // true UTF8::str_iends_with('BeginMiddleΚόσμε', 'κόσμε'); // true </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: bool |
str_iends_with_any(string $str, array $substrings) X-Ref |
Returns true if the string ends with any of $substrings, false otherwise. - case-insensitive param: string $str <p>The input string.</p> param: string[] $substrings <p>Substrings to look for.</p> return: bool |
str_iindex_first(string $str,string $needle,int $offset = 0,string $encoding = 'UTF-8') X-Ref |
Returns the index of the first occurrence of $needle in the string, and false if not found. Accepts an optional offset from which to begin the search. param: string $str <p>The input string.</p> param: string $needle <p>Substring to look for.</p> param: int $offset [optional] <p>Offset from which to search. Default: 0</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|int |
str_iindex_last(string $str,string $needle,int $offset = 0,string $encoding = 'UTF-8') X-Ref |
Returns the index of the last occurrence of $needle in the string, and false if not found. Accepts an optional offset from which to begin the search. Offsets may be negative to count from the last character in the string. param: string $str <p>The input string.</p> param: string $needle <p>Substring to look for.</p> param: int $offset [optional] <p>Offset from which to search. Default: 0</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|int |
str_index_first(string $str,string $needle,int $offset = 0,string $encoding = 'UTF-8') X-Ref |
Returns the index of the first occurrence of $needle in the string, and false if not found. Accepts an optional offset from which to begin the search. param: string $str <p>The input string.</p> param: string $needle <p>Substring to look for.</p> param: int $offset [optional] <p>Offset from which to search. Default: 0</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|int |
str_index_last(string $str,string $needle,int $offset = 0,string $encoding = 'UTF-8') X-Ref |
Returns the index of the last occurrence of $needle in the string, and false if not found. Accepts an optional offset from which to begin the search. Offsets may be negative to count from the last character in the string. param: string $str <p>The input string.</p> param: string $needle <p>Substring to look for.</p> param: int $offset [optional] <p>Offset from which to search. Default: 0</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|int |
str_insert(string $str,string $substring,int $index,string $encoding = 'UTF-8') X-Ref |
Inserts $substring into the string at the $index provided. param: string $str <p>The input string.</p> param: string $substring <p>String to be inserted.</p> param: int $index <p>The index at which to insert the substring.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_ireplace($search, $replacement, $subject, &$count = null) X-Ref |
Case-insensitive and UTF-8 safe version of <function>str_replace</function>. EXAMPLE: <code> UTF8::str_ireplace('lIzÆ', 'lise', 'Iñtërnâtiônàlizætiøn'); // 'Iñtërnâtiônàlisetiøn' </code> param: string|string[] $search <p> param: string|string[] $replacement <p>The replacement.</p> param: string|string[] $subject <p> param: int $count [optional] <p> return: string|string[] |
str_ireplace_beginning(string $str, string $search, string $replacement) X-Ref |
Replaces $search from the beginning of string with $replacement. param: string $str <p>The input string.</p> param: string $search <p>The string to search for.</p> param: string $replacement <p>The replacement.</p> return: string |
str_ireplace_ending(string $str, string $search, string $replacement) X-Ref |
Replaces $search from the ending of string with $replacement. param: string $str <p>The input string.</p> param: string $search <p>The string to search for.</p> param: string $replacement <p>The replacement.</p> return: string |
str_istarts_with(string $haystack, string $needle) X-Ref |
Check if the string starts with the given substring, case-insensitive. EXAMPLE: <code> UTF8::str_istarts_with('ΚόσμεMiddleEnd', 'Κόσμε'); // true UTF8::str_istarts_with('ΚόσμεMiddleEnd', 'κόσμε'); // true </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: bool |
str_istarts_with_any(string $str, array $substrings) X-Ref |
Returns true if the string begins with any of $substrings, false otherwise. - case-insensitive param: string $str <p>The input string.</p> param: array $substrings <p>Substrings to look for.</p> return: bool |
str_isubstr_after_first_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring after the first occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_isubstr_after_last_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring after the last occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_isubstr_before_first_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring before the first occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_isubstr_before_last_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring before the last occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_isubstr_first(string $str,string $needle,bool $before_needle = false,string $encoding = 'UTF-8') X-Ref |
Gets the substring after (or before via "$before_needle") the first occurrence of the "$needle". param: string $str <p>The input string.</p> param: string $needle <p>The string to look for.</p> param: bool $before_needle [optional] <p>Default: false</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_isubstr_last(string $str,string $needle,bool $before_needle = false,string $encoding = 'UTF-8') X-Ref |
Gets the substring after (or before via "$before_needle") the last occurrence of the "$needle". param: string $str <p>The input string.</p> param: string $needle <p>The string to look for.</p> param: bool $before_needle [optional] <p>Default: false</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_last_char(string $str,int $n = 1,string $encoding = 'UTF-8') X-Ref |
Returns the last $n characters of the string. param: string $str <p>The input string.</p> param: int $n <p>Number of characters to retrieve from the end.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_limit(string $str,int $length = 100,string $str_add_on = '…',string $encoding = 'UTF-8') X-Ref |
Limit the number of characters in a string. param: string $str <p>The input string.</p> param: int $length [optional] <p>Default: 100</p> param: string $str_add_on [optional] <p>Default: …</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_limit_after_word(string $str,int $length = 100,string $str_add_on = '…',string $encoding = 'UTF-8') X-Ref |
Limit the number of characters in a string, but also after the next word. EXAMPLE: <code>UTF8::str_limit_after_word('fòô bàř fòô', 8, ''); // 'fòô bàř'</code> param: string $str <p>The input string.</p> param: int $length [optional] <p>Default: 100</p> param: string $str_add_on [optional] <p>Default: …</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_longest_common_prefix(string $str1,string $str2,string $encoding = 'UTF-8') X-Ref |
Returns the longest common prefix between the $str1 and $str2. param: string $str1 <p>The input sting.</p> param: string $str2 <p>Second string for comparison.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_longest_common_substring(string $str1,string $str2,string $encoding = 'UTF-8') X-Ref |
Returns the longest common substring between the $str1 and $str2. In the case of ties, it returns that which occurs first. param: string $str1 param: string $str2 <p>Second string for comparison.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_longest_common_suffix(string $str1,string $str2,string $encoding = 'UTF-8') X-Ref |
Returns the longest common suffix between the $str1 and $str2. param: string $str1 param: string $str2 <p>Second string for comparison.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_matches_pattern(string $str, string $pattern) X-Ref |
Returns true if $str matches the supplied pattern, false otherwise. param: string $str <p>The input string.</p> param: string $pattern <p>Regex pattern to match against.</p> return: bool |
str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8') X-Ref |
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. param: string $str <p>The input string.</p> param: int $offset <p>The index to check.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: bool |
str_offset_get(string $str, int $index, string $encoding = 'UTF-8') X-Ref |
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. param: string $str <p>The input string.</p> param: int $index <p>The <strong>index</strong> from which to retrieve the char.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_pad(string $str,int $pad_length,string $pad_string = ' ',$pad_type = \STR_PAD_RIGHT,string $encoding = 'UTF-8') X-Ref |
Pad a UTF-8 string to a given length with another string. EXAMPLE: <code>UTF8::str_pad('中文空白', 10, '_', STR_PAD_BOTH); // '___中文空白___'</code> param: string $str <p>The input string.</p> param: int $pad_length <p>The length of return string.</p> param: string $pad_string [optional] <p>String to use for padding the input string.</p> param: int|string $pad_type [optional] <p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_pad_both(string $str,int $length,string $pad_str = ' ',string $encoding = 'UTF-8') X-Ref |
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'. param: string $str param: int $length <p>Desired string length after padding.</p> param: string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_pad_left(string $str,int $length,string $pad_str = ' ',string $encoding = 'UTF-8') X-Ref |
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'. param: string $str param: int $length <p>Desired string length after padding.</p> param: string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_pad_right(string $str,int $length,string $pad_str = ' ',string $encoding = 'UTF-8') X-Ref |
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'. param: string $str param: int $length <p>Desired string length after padding.</p> param: string $pad_str [optional] <p>String used to pad, defaults to space. Default: ' '</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_repeat(string $str, int $multiplier) X-Ref |
Repeat a string. EXAMPLE: <code>UTF8::str_repeat("°~\xf0\x90\x28\xbc", 2); // '°~ð(¼°~ð(¼'</code> param: string $str <p> param: int $multiplier <p> return: string |
str_replace($search,$replace,$subject,int &$count = null) X-Ref |
INFO: This is only a wrapper for "str_replace()" -> the original functions is already UTF-8 safe. Replace all occurrences of the search string with the replacement string param: string|string[] $search <p> param: string|string[] $replace <p> param: string|string[] $subject <p> param: int|null $count [optional] <p> return: string|string[] |
str_replace_beginning(string $str,string $search,string $replacement) X-Ref |
Replaces $search from the beginning of string with $replacement. param: string $str <p>The input string.</p> param: string $search <p>The string to search for.</p> param: string $replacement <p>The replacement.</p> return: string |
str_replace_ending(string $str,string $search,string $replacement) X-Ref |
Replaces $search from the ending of string with $replacement. param: string $str <p>The input string.</p> param: string $search <p>The string to search for.</p> param: string $replacement <p>The replacement.</p> return: string |
str_replace_first(string $search,string $replace,string $subject) X-Ref |
Replace the first "$search"-term with the "$replace"-term. param: string $search param: string $replace param: string $subject return: string |
str_replace_last(string $search,string $replace,string $subject) X-Ref |
Replace the last "$search"-term with the "$replace"-term. param: string $search param: string $replace param: string $subject return: string |
str_shuffle(string $str, string $encoding = 'UTF-8') X-Ref |
Shuffles all the characters in the string. INFO: uses random algorithm which is weak for cryptography purposes EXAMPLE: <code>UTF8::str_shuffle('fòô bàř fòô'); // 'àòôřb ffòô '</code> param: string $str <p>The input string</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_slice(string $str,int $start,int $end = null,string $encoding = 'UTF-8') X-Ref |
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. param: string $str param: int $start <p>Initial index from which to begin extraction.</p> param: int|null $end [optional] <p>Index at which to end extraction. Default: null</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: false|string |
str_snakeize(string $str, string $encoding = 'UTF-8') X-Ref |
Convert a string to e.g.: "snake_case" param: string $str param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_sort(string $str, bool $unique = false, bool $desc = false) X-Ref |
param: string[] $matches return: string |
str_split_array(array $input,int $length = 1,bool $clean_utf8 = false,bool $try_to_use_mb_functions = true) X-Ref |
Convert a string to an array of Unicode characters. EXAMPLE: <code> UTF8::str_split_array(['中文空白', 'test'], 2); // [['中文', '空白'], ['te', 'st']] </code> param: int[]|string[] $input <p>The string[] or int[] to split into array.</p> param: int $length [optional] <p>Max character length of each array param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the param: bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use return: string[][] |
str_split($input,int $length = 1,bool $clean_utf8 = false,bool $try_to_use_mb_functions = true) X-Ref |
Convert a string to an array of unicode characters. EXAMPLE: <code>UTF8::str_split('中文空白'); // array('中', '文', '空', '白')</code> param: int|string $input <p>The string or int to split into array.</p> param: int $length [optional] <p>Max character length of each array param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the param: bool $try_to_use_mb_functions [optional] <p>Set to false, if you don't want to use return: string[] |
str_split_pattern(string $str, string $pattern, int $limit = -1) X-Ref |
str_starts_with(string $haystack, string $needle) X-Ref |
Check if the string starts with the given substring. EXAMPLE: <code> UTF8::str_starts_with('ΚόσμεMiddleEnd', 'Κόσμε'); // true UTF8::str_starts_with('ΚόσμεMiddleEnd', 'κόσμε'); // false </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: bool |
str_starts_with_any(string $str, array $substrings) X-Ref |
Returns true if the string begins with any of $substrings, false otherwise. - case-sensitive param: string $str <p>The input string.</p> param: array $substrings <p>Substrings to look for.</p> return: bool |
str_substr_after_first_separator(string $str, string $separator, string $encoding = 'UTF-8') X-Ref |
Gets the substring after the first occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_substr_after_last_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring after the last occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_substr_before_first_separator(string $str,string $separator,string $encoding = 'UTF-8') X-Ref |
Gets the substring before the first occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_substr_before_last_separator(string $str, string $separator, string $encoding = 'UTF-8') X-Ref |
Gets the substring before the last occurrence of a separator. param: string $str <p>The input string.</p> param: string $separator <p>The string separator.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_substr_first(string $str,string $needle,bool $before_needle = false,string $encoding = 'UTF-8') X-Ref |
Gets the substring after (or before via "$before_needle") the first occurrence of the "$needle". param: string $str <p>The input string.</p> param: string $needle <p>The string to look for.</p> param: bool $before_needle [optional] <p>Default: false</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_substr_last(string $str,string $needle,bool $before_needle = false,string $encoding = 'UTF-8') X-Ref |
Gets the substring after (or before via "$before_needle") the last occurrence of the "$needle". param: string $str <p>The input string.</p> param: string $needle <p>The string to look for.</p> param: bool $before_needle [optional] <p>Default: false</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_surround(string $str, string $substring) X-Ref |
Surrounds $str with the given substring. param: string $str param: string $substring <p>The substring to add to both sides.</p> return: string |
str_titleize(string $str,array $ignore = null,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false,bool $use_trim_first = true,string $word_define_chars = null) X-Ref |
Returns a trimmed string with the first letter of each word capitalized. Also accepts an array, $ignore, allowing you to list words not to be capitalized. param: string $str param: array|string[]|null $ignore [optional] <p>An array of words not to capitalize or param: string $encoding [optional] <p>Default: 'UTF-8'</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the param: string|null $lang [optional] <p>Set the language for special cases: az, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: param: bool $use_trim_first [optional] <p>true === trim the input string, param: string|null $word_define_chars [optional] <p>An string of chars that will be used as return: string |
str_obfuscate(string $str,float $percent = 0.5,string $obfuscateChar = '*',array $keepChars = []) X-Ref |
No description |
str_titleize_for_humans(string $str,array $ignore = [],string $encoding = 'UTF-8') X-Ref |
Returns a trimmed string in proper title case. Also accepts an array, $ignore, allowing you to list words not to be capitalized. Adapted from John Gruber's script. param: string $str param: array $ignore <p>An array of words not to capitalize.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
str_to_binary(string $str) X-Ref |
param: string[] $matches return: string |
str_to_lines(string $str, bool $remove_empty_values = false, int $remove_short_values = null) X-Ref |
param: string $str param: bool $remove_empty_values <p>Remove empty values.</p> param: int|null $remove_short_values <p>The min. string length or null to disable</p> return: string[] |
str_to_words(string $str,string $char_list = '',bool $remove_empty_values = false,int $remove_short_values = null) X-Ref |
Convert a string into an array of words. EXAMPLE: <code>UTF8::str_to_words('中文空白 oöäü#s', '#') // array('', '中文空白', ' ', 'oöäü#s', '')</code> param: string $str param: string $char_list <p>Additional chars for the definition of "words".</p> param: bool $remove_empty_values <p>Remove empty values.</p> param: int|null $remove_short_values <p>The min. string length or null to disable</p> return: string[] |
str_transliterate(string $str,string $unknown = '?',bool $strict = false) X-Ref |
alias for "UTF8::to_ascii()" param: string $str param: string $unknown param: bool $strict return: string |
str_truncate(string $str,int $length,string $substring = '',string $encoding = 'UTF-8') X-Ref |
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. param: string $str param: int $length <p>Desired length of the truncated string.</p> param: string $substring [optional] <p>The substring to append if it can fit. Default: ''</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> return: string |
str_truncate_safe(string $str,int $length,string $substring = '',string $encoding = 'UTF-8',bool $ignore_do_not_split_words_for_one_word = false) X-Ref |
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. param: string $str param: int $length <p>Desired length of the truncated string.</p> param: string $substring [optional] <p>The substring to append if it can fit. param: string $encoding [optional] <p>Default: 'UTF-8'</p> param: bool $ignore_do_not_split_words_for_one_word [optional] <p>Default: false</p> return: string |
str_underscored(string $str) X-Ref |
Returns a lowercase and trimmed string separated by underscores. 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. param: string $str return: string |
str_upper_camelize(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
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. param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Default: 'UTF-8'</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
str_upper_first(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
alias for "UTF8::ucfirst()" param: string $str param: string $encoding param: bool $clean_utf8 param: string|null $lang param: bool $try_to_keep_the_string_length return: string |
str_word_count(string $str, int $format = 0, string $char_list = '') X-Ref |
Get the number of words in a specific string. EXAMPLES: <code> // format: 0 -> return only word count (int) // UTF8::str_word_count('中文空白 öäü abc#c'); // 4 UTF8::str_word_count('中文空白 öäü abc#c', 0, '#'); // 3 // 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') // 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') </code> param: string $str <p>The input string.</p> param: int $format [optional] <p> param: string $char_list [optional] <p>Additional chars that contains to words and do not start a new word.</p> return: int|string[] |
strcasecmp(string $str1,string $str2,string $encoding = 'UTF-8') X-Ref |
Case-insensitive string comparison. INFO: Case-insensitive version of UTF8::strcmp() EXAMPLE: <code>UTF8::strcasecmp("iñtërnâtiôn\nàlizætiøn", "Iñtërnâtiôn\nàlizætiøn"); // 0</code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
strchr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
alias for "UTF8::strstr()" param: string $haystack param: string $needle param: bool $before_needle param: string $encoding param: bool $clean_utf8 return: false|string |
strcmp(string $str1, string $str2) X-Ref |
Case-sensitive string comparison. EXAMPLE: <code>UTF8::strcmp("iñtërnâtiôn\nàlizætiøn", "iñtërnâtiôn\nàlizætiøn"); // 0</code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> return: int |
strcspn(string $str,string $char_list,int $offset = 0,int $length = null,string $encoding = 'UTF-8') X-Ref |
Find length of initial segment not matching mask. param: string $str param: string $char_list param: int $offset param: int|null $length param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
strichr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
alias for "UTF8::stristr()" param: string $haystack param: string $needle param: bool $before_needle param: string $encoding param: bool $clean_utf8 return: false|string |
string($intOrHex) X-Ref |
Create a UTF-8 string from code points. INFO: opposite to UTF8::codepoints() EXAMPLE: <code>UTF8::string(array(246, 228, 252)); // 'öäü'</code> param: int|int[]|string|string[] $intOrHex <p>Integer or Hexadecimal codepoints.</p> return: string |
string_has_bom(string $str) X-Ref |
Checks if string starts with "BOM" (Byte Order Mark Character) character. EXAMPLE: <code>UTF8::string_has_bom("\xef\xbb\xbf foobar"); // true</code> param: string $str <p>The input string.</p> return: bool |
strip_tags(string $str,string $allowable_tags = null,bool $clean_utf8 = false) X-Ref |
Strip HTML and PHP tags from a string + clean invalid UTF-8. EXAMPLE: <code>UTF8::strip_tags("<span>κόσμε\xa0\xa1</span>"); // 'κόσμε'</code> param: string $str <p> param: string|null $allowable_tags [optional] <p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: string |
strip_whitespace(string $str) X-Ref |
Strip all whitespace characters. This includes tabs and newline characters, as well as multibyte whitespace such as the thin space and ideographic space. EXAMPLE: <code>UTF8::strip_whitespace(' Ο συγγραφέας '); // 'Οσυγγραφέας'</code> param: string $str return: string |
stripos(string $haystack,string $needle,int $offset = 0,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the position of the first occurrence of a substring in a string, case-insensitive. INFO: use UTF8::stripos_in_byte() for the byte-length EXAMPLE: <code>UTF8::stripos('aσσb', 'ΣΣ'); // 1</code> (σσ == ΣΣ) param: string $haystack <p>The string from which to get the position of the first occurrence of needle.</p> param: string $needle <p>The string to find in haystack.</p> param: int $offset [optional] <p>The position in haystack to start searching.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
stristr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Returns all of haystack starting from and including the first occurrence of needle to the end. EXAMPLE: <code> $str = 'iñtërnâtiônàlizætiøn'; $search = 'NÂT'; UTF8::stristr($str, $search)); // 'nâtiônàlizætiøn' UTF8::stristr($str, $search, true)); // 'iñtër' </code> param: string $haystack <p>The input string. Must be valid UTF-8.</p> param: string $needle <p>The string to look for. Must be valid UTF-8.</p> param: bool $before_needle [optional] <p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|string |
strlen(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Get the string length, not the byte-length! INFO: use UTF8::strwidth() for the char-length EXAMPLE: <code>UTF8::strlen("Iñtërnâtiôn\xE9àlizætiøn")); // 20</code> param: string $str <p>The string being checked for length.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
strlen_in_byte(string $str) X-Ref |
Get string length in byte. param: string $str return: int |
strnatcasecmp(string $str1, string $str2, string $encoding = 'UTF-8') X-Ref |
Case-insensitive string comparisons using a "natural order" algorithm. INFO: natural order version of UTF8::strcasecmp() EXAMPLES: <code> UTF8::strnatcasecmp('2', '10Hello WORLD 中文空白!'); // -1 UTF8::strcasecmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // 1 UTF8::strnatcasecmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // 1 UTF8::strcasecmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // -1 </code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
strnatcmp(string $str1, string $str2) X-Ref |
String comparisons using a "natural order" algorithm INFO: natural order version of UTF8::strcmp() EXAMPLES: <code> UTF8::strnatcmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // -1 UTF8::strcmp('2Hello world 中文空白!', '10Hello WORLD 中文空白!'); // 1 UTF8::strnatcmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // 1 UTF8::strcmp('10Hello world 中文空白!', '2Hello WORLD 中文空白!'); // -1 </code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> return: int |
strncasecmp(string $str1,string $str2,int $len,string $encoding = 'UTF-8') X-Ref |
Case-insensitive string comparison of the first n characters. EXAMPLE: <code> UTF8::strcasecmp("iñtërnâtiôn\nàlizætiøn321", "iñtërnâtiôn\nàlizætiøn123", 5); // 0 </code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> param: int $len <p>The length of strings to be used in the comparison.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
strncmp(string $str1,string $str2,int $len,string $encoding = 'UTF-8') X-Ref |
String comparison of the first n characters. EXAMPLE: <code> UTF8::strncmp("Iñtërnâtiôn\nàlizætiøn321", "Iñtërnâtiôn\nàlizætiøn123", 5); // 0 </code> param: string $str1 <p>The first string.</p> param: string $str2 <p>The second string.</p> param: int $len <p>Number of characters to use in the comparison.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
strpbrk(string $haystack, string $char_list) X-Ref |
Search a string for any of a set of characters. EXAMPLE: <code>UTF8::strpbrk('-中文空白-', '白'); // '白-'</code> param: string $haystack <p>The string where char_list is looked for.</p> param: string $char_list <p>This parameter is case-sensitive.</p> return: false|string |
strpos(string $haystack,$needle,int $offset = 0,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the position of the first occurrence of a substring in a string. INFO: use UTF8::strpos_in_byte() for the byte-length EXAMPLE: <code>UTF8::strpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 8</code> param: string $haystack <p>The string from which to get the position of the first occurrence of needle.</p> param: int|string $needle <p>The string to find in haystack.<br>Or a code point as int.</p> param: int $offset [optional] <p>The search offset. If it is not specified, 0 is used.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
strpos_in_byte(string $haystack, string $needle, int $offset = 0) X-Ref |
Find the position of the first occurrence of a substring in a string. param: string $haystack <p> param: string $needle <p> param: int $offset [optional] <p> return: false|int |
stripos_in_byte(string $haystack, string $needle, int $offset = 0) X-Ref |
Find the position of the first occurrence of a substring in a string, case-insensitive. param: string $haystack <p> param: string $needle <p> param: int $offset [optional] <p> return: false|int |
strrchr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the last occurrence of a character in a string within another. EXAMPLE: <code>UTF8::strrchr('κόσμεκόσμε-äöü', 'κόσμε'); // 'κόσμε-äöü'</code> param: string $haystack <p>The string from which to get the last occurrence of needle.</p> param: string $needle <p>The string to find in haystack</p> param: bool $before_needle [optional] <p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|string |
strrev(string $str, string $encoding = 'UTF-8') X-Ref |
Reverses characters order in the string. EXAMPLE: <code>UTF8::strrev('κ-öäü'); // 'üäö-κ'</code> param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
strrichr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the last occurrence of a character in a string within another, case-insensitive. EXAMPLE: <code>UTF8::strrichr('Aκόσμεκόσμε-äöü', 'aκόσμε'); // 'Aκόσμεκόσμε-äöü'</code> param: string $haystack <p>The string from which to get the last occurrence of needle.</p> param: string $needle <p>The string to find in haystack.</p> param: bool $before_needle [optional] <p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|string |
strripos(string $haystack,$needle,int $offset = 0,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the position of the last occurrence of a substring in a string, case-insensitive. EXAMPLE: <code>UTF8::strripos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13</code> param: string $haystack <p>The string to look in.</p> param: int|string $needle <p>The string to look for.</p> param: int $offset [optional] <p>Number of characters to ignore in the beginning or end.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
strripos_in_byte(string $haystack, string $needle, int $offset = 0) X-Ref |
Finds position of last occurrence of a string within another, case-insensitive. param: string $haystack <p> param: string $needle <p> param: int $offset [optional] <p> return: false|int |
strrpos(string $haystack,$needle,int $offset = 0,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Find the position of the last occurrence of a substring in a string. EXAMPLE: <code>UTF8::strrpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13</code> param: string $haystack <p>The string being checked, for the last occurrence of needle</p> param: int|string $needle <p>The string to find in haystack.<br>Or a code point as int.</p> param: int $offset [optional] <p>May be specified to begin searching an arbitrary number of characters param: string $encoding [optional] <p>Set the charset.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
strrpos_in_byte(string $haystack, string $needle, int $offset = 0) X-Ref |
Find the position of the last occurrence of a substring in a string. param: string $haystack <p> param: string $needle <p> param: int $offset [optional] <p>May be specified to begin searching an arbitrary number of characters into return: false|int |
strspn(string $str,string $mask,int $offset = 0,int $length = null,string $encoding = 'UTF-8') X-Ref |
Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask. EXAMPLE: <code>UTF8::strspn('iñtërnâtiônàlizætiøn', 'itñ'); // '3'</code> param: string $str <p>The input string.</p> param: string $mask <p>The mask of chars</p> param: int $offset [optional] param: int|null $length [optional] param: string $encoding [optional] <p>Set the charset.</p> return: false|int |
strstr(string $haystack,string $needle,bool $before_needle = false,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Returns part of haystack string from the first occurrence of needle to the end of haystack. EXAMPLE: <code> $str = 'iñtërnâtiônàlizætiøn'; $search = 'nât'; UTF8::strstr($str, $search)); // 'nâtiônàlizætiøn' UTF8::strstr($str, $search, true)); // 'iñtër' </code> param: string $haystack <p>The input string. Must be valid UTF-8.</p> param: string $needle <p>The string to look for. Must be valid UTF-8.</p> param: bool $before_needle [optional] <p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|string |
strstr_in_byte(string $haystack,string $needle,bool $before_needle = false) X-Ref |
Finds first occurrence of a string within another. param: string $haystack <p> param: string $needle <p> param: bool $before_needle [optional] <p> return: false|string |
strtocasefold(string $str,bool $full = true,bool $clean_utf8 = false,string $encoding = 'UTF-8',string $lang = null,bool $lower = true) X-Ref |
Unicode transformation for case-less matching. EXAMPLE: <code>UTF8::strtocasefold('ǰ◌̱'); // 'ǰ◌̱'</code> param: string $str <p>The input string.</p> param: bool $full [optional] <p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string $encoding [optional] <p>Set the charset.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, tr</p> param: bool $lower [optional] <p>Use lowercase string, otherwise use uppercase string. PS: uppercase return: string |
strtolower($str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Make a string lowercase. EXAMPLE: <code>UTF8::strtolower('DÉJÀ Σσς Iıİi'); // 'déjà σσς iıii'</code> param: string $str <p>The string being lowercased.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
strtoupper($str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Make a string uppercase. EXAMPLE: <code>UTF8::strtoupper('Déjà Σσς Iıİi'); // 'DÉJÀ ΣΣΣ IIİI'</code> param: string $str <p>The string being uppercased.</p> param: string $encoding [optional] <p>Set the charset.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
strtr(string $str, $from, $to = '') X-Ref |
Translate characters or replace sub-strings. EXAMPLE: <code> $array = [ 'Hello' => '○●◎', '中文空白' => 'earth', ]; UTF8::strtr('Hello 中文空白', $array); // '○●◎ earth' </code> param: string $str <p>The string being translated.</p> param: string|string[] $from <p>The string replacing from.</p> param: string|string[] $to [optional] <p>The string being translated to to.</p> return: string |
strwidth(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Return the width of a string. INFO: use UTF8::strlen() for the byte-length EXAMPLE: <code>UTF8::strwidth("Iñtërnâtiôn\xE9àlizætiøn")); // 21</code> param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: int |
substr(string $str,int $offset = 0,int $length = null,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Get part of a string. EXAMPLE: <code>UTF8::substr('中文空白', 1, 2); // '文空'</code> param: string $str <p>The string being checked.</p> param: int $offset <p>The first position used in str.</p> param: int|null $length [optional] <p>The maximum length of the returned string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|string |
substr_compare(string $str1,string $str2,int $offset = 0,int $length = null,bool $case_insensitivity = false,string $encoding = 'UTF-8') X-Ref |
Binary-safe comparison of two strings from an offset, up to a length of characters. EXAMPLE: <code> UTF8::substr_compare("○●◎\r", '●◎', 0, 2); // -1 UTF8::substr_compare("○●◎\r", '◎●', 1, 2); // 1 UTF8::substr_compare("○●◎\r", '●◎', 1, 2); // 0 </code> param: string $str1 <p>The main string being compared.</p> param: string $str2 <p>The secondary string being compared.</p> param: int $offset [optional] <p>The start position for the comparison. If negative, it starts param: int|null $length [optional] <p>The length of the comparison. The default value is the largest param: bool $case_insensitivity [optional] <p>If case_insensitivity is TRUE, comparison is case param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
substr_count(string $haystack,string $needle,int $offset = 0,int $length = null,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Count the number of substring occurrences. EXAMPLE: <code>UTF8::substr_count('中文空白', '文空', 1, 2); // 1</code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> param: int $offset [optional] <p>The offset where to start counting.</p> param: int|null $length [optional] <p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: false|int |
substr_count_in_byte(string $haystack,string $needle,int $offset = 0,int $length = null) X-Ref |
Count the number of substring occurrences. param: string $haystack <p> param: string $needle <p> param: int $offset [optional] <p> param: int|null $length [optional] <p> return: false|int |
substr_count_simple(string $str,string $substring,bool $case_sensitive = true,string $encoding = 'UTF-8') X-Ref |
Returns the number of occurrences of $substring in the given string. By default, the comparison is case-sensitive, but can be made insensitive by setting $case_sensitive to false. param: string $str <p>The input string.</p> param: string $substring <p>The substring to search for.</p> param: bool $case_sensitive [optional] <p>Whether or not to enforce case-sensitivity. Default: true</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: int |
substr_ileft(string $haystack, string $needle) X-Ref |
Removes a prefix ($needle) from the beginning of the string ($haystack), case-insensitive. EXMAPLE: <code> UTF8::substr_ileft('ΚόσμεMiddleEnd', 'Κόσμε'); // 'MiddleEnd' UTF8::substr_ileft('ΚόσμεMiddleEnd', 'κόσμε'); // 'MiddleEnd' </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: string |
substr_in_byte(string $str, int $offset = 0, int $length = null) X-Ref |
Get part of a string process in bytes. param: string $str <p>The string being checked.</p> param: int $offset <p>The first position used in str.</p> param: int|null $length [optional] <p>The maximum length of the returned string.</p> return: false|string |
substr_iright(string $haystack, string $needle) X-Ref |
Removes a suffix ($needle) from the end of the string ($haystack), case-insensitive. EXAMPLE: <code> UTF8::substr_iright('BeginMiddleΚόσμε', 'Κόσμε'); // 'BeginMiddle' UTF8::substr_iright('BeginMiddleΚόσμε', 'κόσμε'); // 'BeginMiddle' </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: string |
substr_left(string $haystack, string $needle) X-Ref |
Removes a prefix ($needle) from the beginning of the string ($haystack). EXAMPLE: <code> UTF8::substr_left('ΚόσμεMiddleEnd', 'Κόσμε'); // 'MiddleEnd' UTF8::substr_left('ΚόσμεMiddleEnd', 'κόσμε'); // 'ΚόσμεMiddleEnd' </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> return: string |
substr_replace($str,$replacement,$offset,$length = null,string $encoding = 'UTF-8') X-Ref |
Replace text within a portion of a string. EXAMPLE: <code>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')</code> source: https://gist.github.com/stemar/8287074 param: string|string[] $str <p>The input string or an array of stings.</p> param: string|string[] $replacement <p>The replacement string or an array of stings.</p> param: int|int[] $offset <p> param: int|int[]|null $length [optional] <p>If given and is positive, it represents the length of the param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string|string[] |
substr_right(string $haystack,string $needle,string $encoding = 'UTF-8') X-Ref |
Removes a suffix ($needle) from the end of the string ($haystack). EXAMPLE: <code> UTF8::substr_right('BeginMiddleΚόσμε', 'Κόσμε'); // 'BeginMiddle' UTF8::substr_right('BeginMiddleΚόσμε', 'κόσμε'); // 'BeginMiddleΚόσμε' </code> param: string $haystack <p>The string to search in.</p> param: string $needle <p>The substring to search for.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> return: string |
swapCase(string $str, string $encoding = 'UTF-8', bool $clean_utf8 = false) X-Ref |
Returns a case swapped version of the string. EXAMPLE: <code>UTF8::swapCase('déJÀ σσς iıII'); // 'DÉjà ΣΣΣ IIii'</code> param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: string |
symfony_polyfill_used() X-Ref |
Checks whether symfony-polyfills are used. return: bool |
tabs_to_spaces(string $str, int $tab_length = 4) X-Ref |
param: string $str param: int $tab_length return: string |
titlecase(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Converts the first character of each word in the string to uppercase and all other chars to lowercase. param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
toAscii(string $str,string $subst_chr = '?',bool $strict = false) X-Ref |
alias for "UTF8::to_ascii()" param: string $str param: string $subst_chr param: bool $strict return: string |
toIso8859($str) X-Ref |
alias for "UTF8::to_iso8859()" param: string|string[] $str return: string|string[] |
toLatin1($str) X-Ref |
alias for "UTF8::to_latin1()" param: string|string[] $str return: string|string[] |
toUTF8($str) X-Ref |
alias for "UTF8::to_utf8()" param: string|string[] $str return: string|string[] |
to_ascii(string $str,string $unknown = '?',bool $strict = false) X-Ref |
Convert a string into ASCII. EXAMPLE: <code>UTF8::to_ascii('déjà σσς iıii'); // 'deja sss iiii'</code> param: string $str <p>The input string.</p> param: string $unknown [optional] <p>Character use if character unknown. (default is ?)</p> param: bool $strict [optional] <p>Use "transliterator_transliterate()" from PHP-Intl | WARNING: bad return: string |
to_boolean($str) X-Ref |
param: bool|int|float|string $str return: bool |
to_filename(string $str,bool $use_transliterate = false,string $fallback_char = '-') X-Ref |
Convert given string to safe filename (and keep string case). param: string $str param: bool $use_transliterate No transliteration, conversion etc. is done by default - unsafe characters are param: string $fallback_char return: string |
to_iso8859($str) X-Ref |
Convert a string into "ISO-8859"-encoding (Latin-1). EXAMPLE: <code>UTF8::to_utf8(UTF8::to_iso8859(' -ABC-中文空白- ')); // ' -ABC-????- '</code> param: string|string[] $str return: string|string[] |
to_latin1($str) X-Ref |
alias for "UTF8::to_iso8859()" param: string|string[] $str return: string|string[] |
to_utf8($str, bool $decode_html_entity_to_utf8 = false) X-Ref |
This function leaves UTF-8 characters alone, while converting almost all non-UTF8 to UTF8. <ul> <li>It decode UTF-8 codepoints and Unicode escape sequences.</li> <li>It assumes that the encoding of the original string is either WINDOWS-1252 or ISO-8859.</li> <li>WARNING: It does not remove invalid UTF-8 characters, so you maybe need to use "UTF8::clean()" for this case.</li> </ul> EXAMPLE: <code>UTF8::to_utf8(["\u0063\u0061\u0074"]); // array('cat')</code> param: string|string[] $str <p>Any string or array of strings.</p> param: bool $decode_html_entity_to_utf8 <p>Set to true, if you need to decode html-entities.</p> return: string|string[] |
to_utf8_string(string $str, bool $decode_html_entity_to_utf8 = false) X-Ref |
This function leaves UTF-8 characters alone, while converting almost all non-UTF8 to UTF8. <ul> <li>It decode UTF-8 codepoints and Unicode escape sequences.</li> <li>It assumes that the encoding of the original string is either WINDOWS-1252 or ISO-8859.</li> <li>WARNING: It does not remove invalid UTF-8 characters, so you maybe need to use "UTF8::clean()" for this case.</li> </ul> EXAMPLE: <code>UTF8::to_utf8_string("\u0063\u0061\u0074"); // 'cat'</code> param: string $str <p>Any string.</p> param: bool $decode_html_entity_to_utf8 <p>Set to true, if you need to decode html-entities.</p> return: string |
to_int(string $str) X-Ref |
param: array $matches return: string |
to_string($input) X-Ref |
Returns the given input as string, or null if the input isn't int|float|string and do not implement the "__toString()" method. param: float|int|object|string|null $input return: string|null |
trim(string $str = '', string $chars = null) X-Ref |
Strip whitespace or other characters from the beginning and end of a UTF-8 string. INFO: This is slower then "trim()" 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. EXAMPLE: <code>UTF8::trim(' -ABC-中文空白- '); // '-ABC-中文空白-'</code> param: string $str <p>The string to be trimmed</p> param: string|null $chars [optional] <p>Optional characters to be stripped</p> return: string |
ucfirst(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false,string $lang = null,bool $try_to_keep_the_string_length = false) X-Ref |
Makes string's first char uppercase. EXAMPLE: <code>UTF8::ucfirst('ñtërnâtiônàlizætiøn foo'); // 'Ñtërnâtiônàlizætiøn foo'</code> param: string $str <p>The input string.</p> param: string $encoding [optional] <p>Set the charset for e.g. "mb_" function</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> param: string|null $lang [optional] <p>Set the language for special cases: az, el, lt, param: bool $try_to_keep_the_string_length [optional] <p>true === try to keep the string length: e.g. ẞ return: string |
ucword(string $str,string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
alias for "UTF8::ucfirst()" param: string $str param: string $encoding param: bool $clean_utf8 return: string |
ucwords(string $str,array $exceptions = [],string $char_list = '',string $encoding = 'UTF-8',bool $clean_utf8 = false) X-Ref |
Uppercase for all words in the string. EXAMPLE: <code>UTF8::ucwords('iñt ërn âTi ônà liz æti øn'); // 'Iñt Ërn ÂTi Ônà Liz Æti Øn'</code> param: string $str <p>The input string.</p> param: string[] $exceptions [optional] <p>Exclusion for some words.</p> param: string $char_list [optional] <p>Additional chars that contains to words and do not start a new param: string $encoding [optional] <p>Set the charset.</p> param: bool $clean_utf8 [optional] <p>Remove non UTF-8 chars from the string.</p> return: string |
urldecode(string $str, bool $multi_decode = true) X-Ref |
Multi decode HTML entity + fix urlencoded-win1252-chars. EXAMPLE: <code>UTF8::urldecode('tes%20öäü%20\u00edtest+test'); // 'tes öäü ítest test'</code> 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' param: string $str <p>The input string.</p> param: bool $multi_decode <p>Decode as often as possible.</p> return: string |
urldecode_fix_win1252_chars() X-Ref |
Return a array with "urlencoded"-win1252 -> UTF-8 return: string[] |
utf8_decode(string $str, bool $keep_utf8_chars = false) X-Ref |
Decodes a UTF-8 string to ISO-8859-1. EXAMPLE: <code>UTF8::encode('UTF-8', UTF8::utf8_decode('-ABC-中文空白-')); // '-ABC-????-'</code> param: string $str <p>The input string.</p> param: bool $keep_utf8_chars return: string |
utf8_encode(string $str) X-Ref |
Encodes an ISO-8859-1 string to UTF-8. EXAMPLE: <code>UTF8::utf8_decode(UTF8::utf8_encode('-ABC-中文空白-')); // '-ABC-中文空白-'</code> param: string $str <p>The input string.</p> return: string |
utf8_fix_win1252_chars(string $str) X-Ref |
fix -> utf8-win1252 chars param: string $str <p>The input string.</p> return: string |
whitespace_table() X-Ref |
Returns an array with all utf8 whitespace characters. return: string[] |
words_limit(string $str,int $limit = 100,string $str_add_on = '…') X-Ref |
Limit the number of words in a string. EXAMPLE: <code>UTF8::words_limit('fòô bàř fòô', 2, ''); // 'fòô bàř'</code> param: string $str <p>The input string.</p> param: int $limit <p>The limit of words as integer.</p> param: string $str_add_on <p>Replacement for the striped string.</p> return: string |
wordwrap(string $str,int $width = 75,string $break = "\n",bool $cut = false) X-Ref |
Wraps a string to a given number of characters EXAMPLE: <code>UTF8::wordwrap('Iñtërnâtiônàlizætiøn', 2, '<br>', true)); // 'Iñ<br>të<br>rn<br>ât<br>iô<br>nà<br>li<br>zæ<br>ti<br>øn'</code> param: string $str <p>The input string.</p> param: int $width [optional] <p>The column width.</p> param: string $break [optional] <p>The line is broken using the optional break parameter.</p> param: bool $cut [optional] <p> return: string |
wordwrap_per_line(string $str,int $width = 75,string $break = "\n",bool $cut = false,bool $add_final_break = true,string $delimiter = null) X-Ref |
Line-Wrap the string after $limit, but split the string by "$delimiter" before ... ... so that we wrap the per line. param: string $str <p>The input string.</p> param: int $width [optional] <p>The column width.</p> param: string $break [optional] <p>The line is broken using the optional break parameter.</p> param: bool $cut [optional] <p> param: bool $add_final_break [optional] <p> param: string|null $delimiter [optional] <p> return: string |
ws() X-Ref |
Returns an array of Unicode White Space characters. return: string[] |
is_utf8_string(string $str, bool $strict = false) X-Ref |
Checks whether the passed string contains only byte sequences that are valid UTF-8 characters. EXAMPLE: <code> UTF8::is_utf8_string('Iñtërnâtiônàlizætiøn']); // true // UTF8::is_utf8_string("Iñtërnâtiônàlizætiøn\xA0\xA1"); // false </code> param: string $str <p>The string to be checked.</p> param: bool $strict <p>Check also if the string is not UTF-16 or UTF-32.</p> return: bool |
fixStrCaseHelper(string $str,bool $use_lowercase = false,bool $use_full_case_fold = false) X-Ref |
param: string $str param: bool $use_lowercase <p>Use uppercase by default, otherwise use lowercase.</p> param: bool $use_full_case_fold <p>Convert not only common cases.</p> return: string |
getData(string $file) X-Ref |
get data from "/data/*.php" param: string $file return: array |
initEmojiData() X-Ref |
return: true|null |
mbstring_overloaded() X-Ref |
reduce_string_array(array $strings,bool $remove_empty_values,int $remove_short_values = null) X-Ref |
param: array $strings param: bool $remove_empty_values param: int|null $remove_short_values return: array |
rxClass(string $s, string $class = '') X-Ref |
rxClass param: string $s param: string $class return: string |
str_capitalize_name_helper(string $names,string $delimiter,string $encoding = 'UTF-8') X-Ref |
Personal names such as "Marcus Aurelius" are sometimes typed incorrectly using lowercase ("marcus aurelius"). param: string $names param: string $delimiter param: string $encoding return: string |
strtonatfold(string $str) X-Ref |
Generic case-sensitive transformation for collation matching. param: string $str <p>The input string</p> return: string|null |
to_utf8_convert_helper($input) X-Ref |
param: int|string $input return: string |
urldecode_unicode_helper(string $str) X-Ref |
param: string $str return: string |
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |