Wie kann ich den folgenden Code neu einteilen, um ihn übersichtlicher und wartungsfreundlicher zu machen?Wie kann ich einen String ganz einfach in PHP einem String zuordnen?
if ($row['vocation'] == 1) $vocation = "sorcerer";
if ($row['vocation'] == 2) $vocation = "druid";
if ($row['vocation'] == 3) $vocation = "paladin";
if ($row['vocation'] == 4) $vocation = "knight";
if ($row['vocation'] == 5) $vocation = "master sorcerer";
if ($row['vocation'] == 6) $vocation = "elder druid";
if ($row['vocation'] == 7) $vocation = "royal paladin";
if ($row['vocation'] == 8) $vocation = "elite knight";
else $vocation = "none";
oooh Ich hoffe, dass der ursprüngliche Fragesteller diese Frage wieder finden kann, dachte nicht darüber nach, als ich den Titel änderte – thomasrutter