PHP Search and Replace

How to do Php Search and Replace using get method ?

If you have an page url like http://yourdomain.com/somepage?myword=AAA and you want to replace the AAA with BBB just use this code

$word=$_GET['myword'];
$search = array('A');
$replace = array('B');
$replaced_word = str_replace($search, $replace, $word);
echo $replaced_word;

THIS CODE WILL GIVE THE OUT PUT

BBB