How to specify positional replacement in php

hzc
Release: 2023-03-01 15:58:01
Original
2772 people have browsed it

How to specify positional replacement in php

How to specify positional replacement in php?

Using the substr_replace() function

Definition and usage
The substr_replace() function replaces part of a string with another string.

Syntax
substr_replace(string,replacement,start,length)

<?php教程
echo substr_replace("hello world","earth",6);
?>
Copy after login

string Required. Specifies the string to check

replacement Required. Specifies the string to be inserted.

start Required. Specifies where in the string to start replacing

Optional. Specifies how many characters to replace.

Recommended tutorial: "php tutorial"

The above is the detailed content of How to specify positional replacement in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!