Home  >  Article  >  Backend Development  >  PHP substr_replace() function syntax and parameters_PHP tutorial

PHP substr_replace() function syntax and parameters_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:54:331115browse

PHP substr_replace() function syntax

substr_replace(string,replacement,start,length)

Parameters Description
string Required. Specifies the string to check.
replacement Required. Specifies the string to be inserted.
start
参数 描述
string 必需。规定要检查的字符串。
replacement 必需。规定要插入的字符串。
start

必需。规定在字符串的何处开始替换。

  • 正数 - 在第 start 个偏移量开始替换
  • 负数 - 在从字符串结尾的第 start 个偏移量开始替换
  • 0 - 在字符串中的第一个字符处开始替换
charlist

可选。规定要替换多少个字符。

  • 正数 - 被替换的字符串长度
  • 负数 - 从字符串末端开始的被替换字符数
  • 0 - 插入而非替换
Required. Specifies where in the string to begin replacement.
  • Positive number - start replacement at start offset
  • Negative number - replace at start offset from the end of the string
  • 0 - Start replacement at the first character in the string
charlist Optional. Specifies how many characters to replace.

  • Positive number - the length of the string to be replaced
  • Negative number - the number of characters to be replaced starting from the end of the string
  • 0 - insert instead of replace
http://www.bkjia.com/PHPjc/364579.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364579.htmlTechArticle
PHP substr_replace() Function syntax substr_replace(string,replacement,start,length) Parameter description string required. Specifies the string to check. replacement required. Specifies what to insert...
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