• PHP Video Tutorials

PHP - Function Substr_replace



Syntax

substr_replace(string,replacement,start,length)

Definition and Usage

It used to replace the part of string with another string

Return Values

It returns the replaced string, if returned string is an array than it returns an array

Parameters

Sr.No Parameters & Description
1

string

It is used to specifies string to check

2

replacement

It is used to specifies the string to insert

3

start

It specifies when in string to start inserting

4

length

It specifies length of a string

Example

Try out the following example

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

This will produce following result −

Tutorials Point
php_function_reference.htm
Advertisements