Learn PHP Tutorial 29 String Function and substring

Publicado em: 31 Dezembro 2015
no canal de: Champion Mahipal
237
3

This video is made for learning about String Function and sub string in PHP.

substr — Return part of a string

Description ¶

string substr ( string $string , int $start [, int $length ] )
Returns the portion of string specified by the start and length parameters.

Parameters ¶

string
The input string. Must be one character or longer.

start
If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

If start is negative, the returned string will start at the start'th character from the end of string.

If string is less than start characters long, FALSE will be returned.

The substr function in PHP is used to retrieve a portion of the string. The syntax of the substr function is:

substr ('string', position_start, substr_length)

where position_start is the starting point (the first character has a position of 0). if position_start is a negative number, the starting position is the -(position_start)th character from the end. substr_length is the length of the string to be returned. If substr_length is a negative number, that means substr_legnth characters will be omitted from the end of the string.


Nesta página do site você pode assistir ao vídeo on-line Learn PHP Tutorial 29 String Function and substring duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Champion Mahipal 31 Dezembro 2015, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 237 vezes e gostou 3 espectadores. Boa visualização!