Skip to content

Kirby 3.9.2


Replaces all or some occurrences of the search string with the replacement string Extension of the str_replace() function in PHP with an additional $limit parameter

Str::replace(string|array $string, string|array $search, string|array $replace, int|array $limit = -1): string|array


Name Type Default Description
$string * string|array String being replaced on (haystack);
can be an array of multiple subject strings
$search * string|array Value being searched for (needle)
$replace * string|array Value to replace matches with
$limit int|array -1 Maximum possible replacements for each search value;
multiple limits for each search value are supported;
defaults to no limit

Return type


Parent class