PHP function str_replace()

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.

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

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.