Newer Version Available
substr()
Syntax
substr(string,position[, length])
Usage
substr returns the characters in string, starting at position position. If you specify length, this function returns length number of characters. If any of the parameters are null, then the function returns null. length is optional.
The first character in string is at position 1. If position is negative then the position is relative to the end of the string. So a position of -1 denotes the last character.
If length is negative, then the function returns null. If position > len (string) or position < -len(string) or position = 0, then the empty string is returned.