Use of strings in PHP programs

Source: Internet
Author: User
: This article mainly introduces the use of strings in PHP programs. For more information about PHP tutorials, see. 1. string declaration

(1) single quotation marks and double quotation marks can be used.

Difference: variables can be parsed in double quotes and all escape characters can be used.

(2) use delimiters <

2. String Processing

It mainly uses strings for segmentation, matching, search, and replacement.

3. string processing functions

Features:

1. for other types of data, you can also use string processing functions. the processing process is to convert other types of data into strings and then process them.

2. a string can access each character like an array through subscript, but the type is not an array, it is a string

3. besides English and Chinese characters (UTF8 occupies 3 bytes for different encodings)

(1) strlen ("hello"); count the length of the string

(2) $ str [0]. $ str [1]; the first and second elements of the access string $ str. the type is a string. (You can also use {} to access subscript)

The above describes the use of strings in the PHP program, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.

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.