fb_utf8_substr
Cuts a portion of str specified by the start and length parameters
function fb_utf8_substr(
string $str,
int $start,
int $length = PHP_INT_MAX,
): string;
Parameters
string $str
- The original string.int $start
- If start is non-negative, fb_utf8_substr() cuts the portion out of str beginning at start'th character, counting from zero. If start is negative, fb_utf8_substr() cuts out the portion beginning at the position, start characters away from the end of str.int $length = PHP_INT_MAX
- If length is given and is positive, the return value will contain at most length characters of the portion that begins at start (depending on the length of string). If negative length is passed, fb_utf8_substr() cuts the portion out of str from the start'th character up to the character that is length characters away from the end of the string. In case start is also negative, the start position is calculated beforehand according to the rule explained above.
Returns
string
- - Returns the portion of str specified by the start and length parameters. If str is shorter than start characters long, the empty string will be returned.