Learn PHP Note string handling

Source: Internet
Author: User
Tags learn php local time locale setting
SUBSTR ();

SUBSTR (str,start,length);

Example: substr (' PHP is very good language ', 4,5);

Output is ve;

When the length of the start>str, then return to ();

substr (' PHP is very good language ', 26,5);

substr (' PHP is very good language ', 4);

Output is (blank)

Output is V (indicates that both start and langth are 4)

When start is negative, start reading from the end of STR (* This is read from-1 instead of starting at 0),

substr (' PHP is very good language ', -4,5);

Output is Uage

When length is negative, length represents the beginning of reading from the end and intercepting the end position of str.

substr (' PHP is very good language ', 4,-5);

Output is very good LAN

explode () splits the function string into arrays;

Strrev () the function string

Setlocalhost (content location) sets the local environment. Content, specifying the scene information constants that need to be set (

lc_all– all subordinate constants
lc_collate– Arrange Order
lc_ctype– character classification and conversion (for example, converting all characters to lowercase or uppercase)
lc_messages– System Information Format
lc_monetary– Money/Currency format
lc_numeric– Numeric format
lc_time– Date and time formats
Location, set up a country area, for example, chs.

Strftime () Formats the local time/date according to the locale setting.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.