Filters::replace and Filters:replaceRe shoul have arguments count same as str_replace and preg_replace

Notice: This thread is very old.
Vlady
Member | 1
+
0
-

Filter:replace is missing $count argument, that was added to str_replace in PHP 5.0
Filter:replaceRe is missing $limit argument and $count argument added to preg_replace in PHP 5.1.0

Programmer used to $count and/or $limit arguments should be able to use these in helpers same way as in functions. It allows one to replace only single or N found occurences of text.

Ex. Replace only first line in address by <strong>first line</strong>

David Grudl
Nette Core | 8111
+
0
-

$count in str_replace returns number of replacements, it cannot be used as limit.