Answer the question
In order to leave comments, you need to log in
How does str_replace work?
Code like this:
$one = ['a','b'];
$two = ['b', 'a'];
$str = 'ab';
echo str_replace($one, $two, $str);
Answer the question
In order to leave comments, you need to log in
In your case, all the letters a are replaced by b , it turns out 'bb',
then all b are changed to a , it turns out 'aa'
example from documentation// Выводит: яблорехкорех орех (по вышеуказанной причине) $letters = array('я', 'о'); $fruit = array('яблоко', 'орех'); $text = 'я о'; $output = str_replace($letters, $fruit, $text); echo $output;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question