Definition and Usage
5.4.8 null is passed in the length, which is extracted from the start to the end of the string. In previous versions, null was treated as 0.
mb_substr( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] )
mb_substr()Performs a multibyte safe substr() operation based on the number of characters. The position is counted from the start of the str. The position of the first character is 0. The position of the second character is 1, and so on.
|str||yes||Extract the substring from the string.|
|start||yes||If start is not a negative number, the string returned will start at STR start and count from 0. For example, the string ‘ABCDEF’, the character at position 0 is’ a ‘, the character at position 2 is’ C’, and so on. If start is a negative number, the string returned starts with the start character at the end of str.|
|length||yes||The maximum number of characters to use in str. If this parameter is omitted or null is passed in, the end of the string is extracted.|
The encoding parameter is character encoding. If omitted, internal character encoding is used.
echo mb_substr("hello world",2,3);