array string replacer

Posted under » PHP on 03 June 2010

There will be times when you want to change certain text in your cms to another or create a hyperlink. One way to do it is to use a string replacer.

Ok to cut a long story short.

$wrong = array("yahoo", "google");
$right = array("Yahoo","Google");
$new_text = str_replace($wrong, $right, $original_text);

See also
string replacer. string replacer using XML array.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS