substr expression function

Returns a substring of a string.

All Usage Examples

Usage

substr(s, start, length)

Returns the characters of s between the start position and the start + length position.

Examples

echo `substr("STRING", 3, 1)`

Returns I.

echo `substr("STRING", 0, 3)`

Returns STR.

echo `substr("STRING", 3, 2)`

Returns IN.