Tagged articles
mb_substr
11 articles · Page 1 of 1
Learn how to efficiently truncate strings in PHP using five approaches—substr for ASCII, mb_substr for multibyte characters, regex with preg_match, explode with array handling, and a custom function that adds ellipsis—while understanding each method's syntax, advantages, and limitations.
String Manipulationcustom-functionexplode
0 likes · 5 min read

This article explains how PHP's mb_substr() function safely extracts portions of multibyte strings, details its syntax, parameters, and provides clear code examples demonstrating correct usage, edge cases, and its importance for multilingual web development.
BackendStringmb_substr
0 likes · 3 min read

This article explains PHP's mb_substr() function, its signature, parameters, and provides clear examples showing how to correctly extract substrings from multibyte strings such as Chinese or Japanese without causing garbled output.
BackendString Manipulationmb_substr
0 likes · 3 min read

The article explains PHP's mb_substr() function, detailing its syntax, parameters, and how it correctly handles multibyte characters, with multiple code examples and notes on edge cases, making it essential for developers working on internationalized backend projects.
BackendPHPString Manipulation
0 likes · 3 min read

The article explains the PHP mb_substr() function, its syntax, parameter meanings, and provides multiple code examples demonstrating how to correctly truncate multibyte strings such as Chinese or Japanese without causing garbled output, along with important usage notes.
BackendPHPString
0 likes · 4 min read

The PHP mb_substr() function provides multibyte‑aware substring extraction, allowing developers to specify start position, length, and encoding to correctly handle Unicode strings, with detailed parameter explanations, return values, important usage notes, and practical code examples.
Stringencodingmb_substr
0 likes · 5 min read

This article explains how PHP's substr() and mb_substr() functions work, detailing their syntax, parameter behavior for positive and negative start and length values, and provides multiple code examples demonstrating string extraction for both English and multibyte Chinese characters.
BackendPHPString Manipulation
0 likes · 6 min read

This article explains several essential PHP string functions—including substr, mb_substr, stripos with substr, and direct character indexing—providing clear code examples and output demonstrations for handling both ASCII and multibyte characters.
BackendStringmb_substr
0 likes · 3 min read

This article explains the PHP mb_substr() function, detailing its multibyte‑safe substring behavior, parameter list (str, start, length, encoding), return value, and provides a clear example showing how to extract the first two characters from a Chinese string.
BackendFunctionPHP
0 likes · 2 min read

The article explains PHP's mb_substr() function for multibyte-safe substring extraction, detailing its parameters, usage, and return value, and provides two practical code examples demonstrating how to extract Chinese characters with specified length and encoding.
StringSubstringencoding
0 likes · 2 min read

This article explains PHP’s mb_substr() function, detailing its multibyte‑safe substring behavior, parameter definitions, return value, and provides a practical code example illustrating how to extract a portion of a Chinese string correctly.
PHPStringSubstring
0 likes · 2 min read
