Hello I am new to PHP and I don't know exactaly what does this code means

$de = array('Ä'=>'ae','ä'=>'ae','Ü'=>'ue','ü'=>'ue', 'Ö'=>'oe', 'ö'=>'oe', 'ß'=>'ss');
 strtr($str, ${$de});

The only thing that I need to know is what does it means **

"${$de}" ??


thanks a lot for the help.


can "variable variables" contain an array?

Written by Codler

What does it actually do? I would have thought that this should be written as 'strtr($str, $de)' - I'd expect the indirection to cause a warning and the code to fail.

Written by symcbean

Accepted Answer

It's a variable variable, one of the most intriguing part of the php implementation.

Sometimes usefull, always confusing:

$Bar = "a";
$Foo = "Bar";
$World = "Foo";
$Hello = "World";
$a = "Hello";

$a; //Returns Hello
$$a; //Returns World
$$$a; //Returns Foo
$$$$a; //Returns Bar
$$$$$a; //Returns a
$$$$$$a; //Returns Hello
$$$$$$$a; //Returns World
Written by SWeko
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki