September 2001
Intermediate to advanced
768 pages
32h 45m
English
string substr(string string, int start, [int length])
| string | String to operate on |
| start | Offset of the substring |
| length | Length of the substring |
Gets part of a string.
Returns:
String; FALSE on error
Description:
substr() is used to get part of a string. The part of the string to be returned is specified as a range using the start and length arguments.
Behavior of the start and length arguments is interesting, allowing for a great deal of flexibility in choosing what part of the string to replace. See the following table for details.
| Argument | Value | Behavior |
|---|---|---|
| start | Non-negative integer | Start the substring at start characters into the string. |
| start | Negative integer | Start the substring at start characters from the end of the string. ... |
Read now
Unlock full access