UK ['sʌbstər] US ['sʌbstər]

abbr.substructure substructure, underground building

php substr() function syntax

Function:Intercept string

Syntax:substr(string,start,length)

Parameters:

Parameter Description
string Required. Specifies a part of the string to be returned.
start Required. Specifies where in the string to begin. Positive number - starts at the specified position in the string, negative number - starts at the specified position from the end of the string, 0 - starts at the first character in the string.
length Optional. Specifies the length of the returned string. The default is until the end of the string. Positive number - the length returned from the position of the start parameter, negative number - the length returned from the end of the string.

Description:Returns part of the string. If the start parameter is negative and length is less than or equal to start, length is 0.

php substr() function example


Run instance»

Click the "Run instance" button to view the online instance

Output:

world

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

y in php.cn