Home > Backend Development > PHP Tutorial > Learning PHP Notes String Processing_PHP Tutorial

Learning PHP Notes String Processing_PHP Tutorial

WBOY
Release: 2016-07-21 15:34:01
Original
811 people have browsed it

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322518.htmlTechArticlesubstr(); substr(str,start,length); Example: substr('php is very good language' ,4,5); The output is is ve; When the length of startstr, the return is (); substr('php is very good language',...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template