str_replace与数组

$a = $_GET['a'];
$d = array("æ", "ø", "å", "Æ", "Ø", "Å");
$e = array("&aelig", "&oslash", "&aring", "&AElig", "&Oslash", "&Aring");
$new = str_replace("$d","$e","$a");
echo $new;

Can anybody tell me what I'm doing wrong here. It works perfectly fine if I just write:

$a = $_GET['a'];
new = str_replace("ø","&oslash","$a");
echo $new;

Then atleast the "ø" is replaced, but I really want to do it with two arrays instead of replacing one letter at a time, 6 times...

$new = str_replace($d, $e, $a);

You're passing variables, not a strings that consist of variables.

If you compare outputs in this code

$a = array(123);
var_dump($a);
var_dump("$a");

you'll notice, that the first one is an array, and the second one is a string with array implicitly casted to a string.