Replacement of some characters in a php custom string

Source: Internet
Author: User
The substr_replace () function replaces some characters in a custom string. Syntax: substr_replace (str, repl, start, [intlength]): strmdash; m... the substr_replace () function replaces some characters in the custom string.

Syntax:Substr_replace (str, repl, start, [int length])

Syntax description:

Str -- required parameter, which specifies the original string to be operated

Repl -- specify the new string after replacement

Start -- specify the start position of the string to be replaced

Length -- optional parameter, specifying the length of the returned string

Use the substr_replace () function to replace a string:

 

Parameter description

String is required, which specifies the string to be checked.

Replacement is required, specifying the string to be inserted.

Start

Required, specifying where to start replacement of the string.

Positive number-start replacement at the start offset

Negative number-replace with the start offset at the end of the string

0-START replacement at the first character in the string

Charlist

(Optional) number of characters to be replaced

Positive number-length of the string to be replaced

Negative number-Number of replaced characters starting from the end of the string

0-insert instead of replace

Article URL:

Reprint ^ at will, but please attach the tutorial address.

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.