Tagged articles
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 the three JavaScript string extraction methods—substr(), substring() and slice()—highlighting why slice() is now preferred, detailing deprecation reasons for substr(), comparing behavior, parameter handling, and consistency, and summarizing its advantages over the other methods.
JavaScriptString MethodsSubstring
0 likes · 4 min read

This article explains how to use PHP's substr() function to extract portions of a string, covering its syntax, parameters, and practical examples including specifying start positions, lengths, and negative offsets for flexible substring extraction.
BackendPHPString
0 likes · 4 min read

This article explains how to use PHP's built‑in substr function to retrieve substrings by specifying start positions and lengths, covering basic syntax, parameter details, return values, and common examples such as extracting the last characters, specific ranges, and converting substrings to uppercase.
BackendPHPString Manipulation
0 likes · 4 min read

This article explains PHP's substr() function, covering its syntax, parameters, return values, and provides multiple code examples demonstrating how to extract, replace, and change the case of substrings; it also discusses handling of negative start positions and optional length arguments.
Code ExamplesPHPString Manipulation
0 likes · 6 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 introduces ten essential PHP string manipulation functions—including substr, str_replace, implode, strpos, and sprintf—explaining their purpose and providing clear code examples that demonstrate how to extract, replace, concatenate, search, split, trim, and format strings efficiently in PHP development.
PHPString Functionsimplode
0 likes · 5 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 PHP's substr() function, detailing its purpose, parameter rules, return values, and provides multiple code examples demonstrating positive, negative, and omitted start/length arguments as well as character access via indexing.
FunctionPHPString Manipulation
0 likes · 4 min read

This article explains PHP's substr() function, detailing its signature, parameter meanings, behavior with positive and negative start and length values, edge cases, and provides multiple code examples demonstrating how to extract substrings under various conditions.
Backendphp-functionsstring-manipulation
0 likes · 5 min read

This article explains the PHP substr() function, detailing its signature, parameter behavior for positive and negative start and length values, return values, and provides multiple code examples demonstrating various edge cases and expected outputs.
BackendPHPString Manipulation
0 likes · 3 min read
