Are there any alternative PHP functions that can achieve the same result as substr() for string manipulation?

The substr() function in PHP is commonly used for extracting a portion of a string. If you are looking for alternative functions for string manipulation, you can consider using substr_replace() or mb_substr() for multibyte strings. These functions can achieve similar results to substr() but with some additional features or capabilities.

// Using substr_replace() as an alternative to substr() for string manipulation
$string = "Hello, World!";
$modifiedString = substr_replace($string, "Universe", 7, 5);
echo $modifiedString;

// Using mb_substr() for multibyte string manipulation
$mbString = "こんにちは、世界!";
$modifiedMbString = mb_substr($mbString, 0, 5, 'UTF-8');
echo $modifiedMbString;