PHP - substr_replace 函式



語法

substr_replace(string,replacement,start,length)

定義和用法

用於將字串的一部分替換為另一個字串。

返回值

返回替換後的字串,如果返回值為陣列,則返回陣列。

引數

序號 引數及描述
1

string

指定要檢查的字串。

2

replacement

指定要插入的字串。

3

start

指定在字串中開始插入的位置。

4

length

指定字串的長度。

示例

嘗試以下示例

<?php
   echo substr_replace("Tutorilas point","Tutorials Point",0);
?>

這將產生以下結果:

Tutorials Point
php_function_reference.htm
廣告