Hello, there are 2 values ​​derived from the database, when displayed in my plate, they are displayed cafe and bar: how can I replace these words with php?

I managed to replace only one value:

<?php function callback($bar) { return (str_replace("bar", "Бар", $bar)); } ob_start("callback"); php ob_end_flush(); ?> 

thank you in advance :)

    2 answers 2

     str_replace(array('cafe', 'bar'), array('кафе', 'бар'), $subject) 
    • swears: Parse error: syntax error, unexpected '[', expecting ')' in - Evgeny Zarechnev
    • So you have a version of php <5.4. Instead of square brackets use array () - Rjazhenka

    -- Hello! I need to unscrew all the nuts on the wheel. I unscrewed one. How do I unscrew the second?

    First, do not use an output buffer for this. Any replacement should be made only for the data in which these replacements are needed. And not for the entire output of the script. In this case, the replacement must be made before the start of the withdrawal.
    Secondly, do not write the code as if you are fined for every extra line.

    We take a variable in which it is necessary to replace one word with another. And replace:

     $data = str_replace("bar", "Бар", $data); 

    If you need to replace several more variables, we replace them in the same way.

    • forgive me a sinner, I could not figure out the editor, but still the problem remained, maybe because the data of these values ​​is transferred by an array? only there I can show :( pastebin.ru/S1jY0fYj - Evgeny Zarechnev