Condensing PHP query

php

Solution

Use a lookup table:

$table = array(
   'en' => 'Latest News',
   'it' => 'Ultime notizie',
   ....
);

echo $table[qtrans_getLanguage()];

Problem

I have a piece of code which I suspect could be written in a more efficient way but I'm still a little rusty on some PHP queries. Is there a better way to write the following query: ``` <?php if(qtrans_getLanguage()=='en'): echo 'Latest News'; endif; if(qtrans_getLanguage()=='it'): echo 'Ultime notizie'; endif; if(qtrans_getLanguage()=='de'): echo 'Aktuelle Nachrichten'; endif; if(qtrans_getLanguage()=='zh'): echo '最新消息'; endif; if(qtrans_getLanguage()=='es'): echo 'Últimas noticias'; endif; if(qtrans_getLanguage()=='fr'): echo 'Dernières nouvelles'; endif; ?> ```

Original source