UK[rɪˈpleɪs] US[rɪˈples]

vt.Replace; replace; put... back into its original place; (with...) replace

Third person singular: replaces Present participle: replacing Past tense: replaced Past participle: replaced

php substr_replace() function syntax

Function:Replace a string in a string with another string

Syntax:substr_replace(string,replacement,start,length)

Parameters:

##Required. Specifies the string to check. replacement Required. Specifies the string to be inserted. start Required. Specifies where in the string to begin replacement. Positive number - starts replacement at the specified position in the string, negative number - starts replacement at the specified position from the end of the string, 0 - starts replacement at the first character in the string. length Optional. Specifies how many characters to replace. The default is the same as the string length. Positive number - the length of the string to be replaced, negative number - the number of characters from the end of the substring to be replaced to the end of string . 0 - Insert instead of replace
Parameter Description
string

# Description:Replace part of a string with another string. If the start parameter is negative and length is less than or equal to start, length is 0. This function is binary safe.

php substr_replace() function example


Run instance»

Click the "Run instance" button to view the online instance

Output:

Hello php.cn

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

i like php