Im creating a web app where I want all of the responses to the user stored in a language file for easy editing. So Im using eval() to manage dynamic messages lik so:
$msg = 'Hello $user, your favorite color is $color';
$colors = array("red","green","blue","yellow");
$users = array("bob","craig","ted","dirty sanchez");
foreach($users as $key => $user){
$color = $colors[$key];
eval("\$newmsg = \"$msg\";");
echo $newmsg;
}
Im wondering if this is the best approach or if there is a better way?