Home > PHP > Function > > grapheme_substr()

grapheme_substr()

grapheme_substr - Return part of a string

Syntax

int grapheme_substr (string $string, int $start, int $length)

Arguments

  • string - The input string. Must be valid UTF-8.
  • start - Start position in default grapheme units. If is non-negative, the returned string will start at the \'th position in , counting from zero. If is negative, the returned string will start at the \'th grapheme unit from the end of string.
  • length - Length in grapheme units. If is given and is positive, the string returned will contain at most grapheme units beginning from (depending on the length of string). If is less than or equal to grapheme units long, FALSE will be returned. If is given and is negative, then that many grapheme units will be omitted from the end of string (after the start position has been calculated when a start is negative). If denotes a position beyond this truncation, an empty string will be returned.

Description

Procedural style

Version

PHP 5.3.0, PECL intl >= 1.0.0

Return value

Returns the extracted part of $string.