Answer the question
In order to leave comments, you need to log in
Why does this record produce a fatal error?
Why does this record produce a fatal error?
Meanwhile, so true:
$text = str_replace("[id", "[", $text, 1);
$count = 1;
$text = str_replace("[id", "[", $text, $count);
Answer the question
In order to leave comments, you need to log in
Because $count is not a limit on the number of replacements, but it records how many times the replacement worked.
Therefore, it is necessary to pass a variable there, not a number.
sandbox.onlinephpfunctions.com/code/87f0105ff5614c...
str_replace(
array|string $search,
array|string $replace,
string|array $subject,
int &$count = null
): string|array
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question