mb_strcut
mb_strcut
Get part of string
string **mb_strcut** string $string int $start $length $encoding
extracts a substring from a string similarly to
, but operates on bytes instead of characters. If the
cut position happens to be between two bytes of a multi-byte character, the cut is
performed starting from the first byte of that character. This is also the difference
to the function, which would simply cut the string between
the bytes and thus result in a malformed byte sequence.
mb_strcut``mb_substr``substr
string
The being cut.
string
start
If is non-negative, the returned string
will start at the 'th position in
, counting from zero. For instance,
in the string '', the byte at
position is '', the
byte at position is
'', and so forth.
start``startbytestring``abcdef``0``a``2``c
If is negative, the returned string
will start at the 'th byte
counting back from the end of . However, if the
magnitude of a negative is greater than the
length of the string, the returned portion will start from the beginning of
.
`start``start``string``start``string`
length
Length in . If omitted or
is passed, extract all bytes to the end of the string.
bytesNULL
If is negative, the returned string will
end at the 'th byte counting back from the
end of . However, if the magnitude of a negative
is greater than the number of characters
after the position, an empty string will
be returned.
`length``length``string``length``start`
encoding
returns the portion of
specified by the
and
parameters.
mb_strcut``string``start``length
mb_substr``mb_internal_encoding