Home  >  Article  >  Backend Development  >  How to specify positional replacement in php

How to specify positional replacement in php

hzc
hzcOriginal
2020-06-19 15:36:402779browse

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);
?>

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!

Statement:
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