Gen. partnerAlgotech

PHP function str_replace()

Replaces all occurrences of the search string with the replacement string.

|
September 11, 2019

Availability in PHP 4.0

Replaces all occurrences of the search string with the replacement string.

Parameters

Parameter Data type Default value Note
$search mixed not Search value, otherwise known as $needle. The field can be used to denote multiple $needle.
$replace mixed not Replacement content for the found value. The field can be used for multiple replacements.
$subject mixed not
$count int null

Return values

mixed

This function returns a string or array of substituted values.

echo str_replace('https://', 'https://', 'https://google.com'); // https://google.com

Other resources

Official str-replace documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.