Name
substr
Synopsis
string substr(stringstring
, intoffset
[, intlength
])
Returns the substring of string
. If
offset
is positive, the substring starts at
that character; if it is negative, the substring starts at the
character offset
characters from the
string’s end. If length
is given and is
positive, that many characters from the start of the substring are
returned. If length
is given and is
negative, the substring ends length
characters from the end of string
. If
length
is not given, the substring contains
all characters to the end of string
.
Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.