In the following snippet of PHP the $phrases needs to reflect the change made in $greeting. How can this be achieved?
$greeting = "Hello!";
$phrases = array('greeting' => $greeting . " Glad to see you.");
echo $phrases['greeting'];
Hello! Glad to see you.
$greeting = "How are you?";
echo $phrases['greeting'];
Hello! Glad to see you.
Note, that even after the value of $greeting variable changed, the array remained unchanged (which is normally an expected behavior, since the value of $greeting var is passed by value).
In order to make array to do change, I tried to use references to variables, but they don't seem to work with concatenation operator ..
Appreciate if anyone could suggest a quick solution to this..