Home >Backend Development >PHP Tutorial >Learning PHP Notes String Processing_PHP Tutorial
substr();
substr(str,start,length);
Example: substr('php is very good language',4,5);
The output is is ve;
When start>str length, the return is ();
substr('php is very good language',26,5);
substr('php is very good language',4);
The output is (blank)
The output is is v (indicating that both start and langth are 4)
When start is a negative value, start reading from the end of str (*In this case, it starts reading from -1, not from 0),
substr('php is very good language ',-4,5);
The output is uage
When length is a negative value, length means reading from the end and intercepting the end position of str.
substr('php is very good language',4,-5);
The output is is very good lan
explode() puts the function string Split into arrays;
strrev() sets the function string
setlocalhost(content location) to set the local environment.content and specify the scene information constants that need to be set. There are (
LC_ALL - constants for all subordinates
LC_COLLATE - sort order
LC_CTYPE - character classification and conversion (for example: convert all characters to lowercase or uppercase)
LC_MESSAGES - system Information format
LC_MONETARY - currency/currency format
LC_NUMERIC - numerical format
LC_TIME - date and time format
); location, set the country area, for example, chs.
strftime( ) formats local time/date according to locale settings.