When to use strtr vs str_replace?

First difference: An interesting example of a different behaviour between strtr and str_replace is in the comments section of the PHP Manual: <?php $arrFrom = array(“1″,”2″,”3″,”B”); $arrTo = array(“A”,”B”,”C”,”D”); $word = “ZBB2″; echo str_replace($arrFrom, $arrTo, $word); ?> I would expect as result: “ZDDB” However, this return: “ZDDD” (Because B = D according to our array) … Read more

Str_replace for multiple items

Like this: str_replace(array(‘:’, ‘\\’, “https://stackoverflow.com/”, ‘*’), ‘ ‘, $string); Or, in modern PHP (anything from 5.4 onwards), the slighty less wordy: str_replace([‘:’, ‘\\’, “https://stackoverflow.com/”, ‘*’], ‘ ‘, $string);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)