We have variable $country, it can give ~50 different values.
And variable $id.
What we should do is to give a value for $id corresponding to $country value, like:
if ($country = 'USA') { $id = 'usa_type'; }
else if ($country = 'France') { $id = 'france_type'; }
else if ($country = 'German') { $id = 'german_type'; }
else if ($country = 'Spain') { $id = 'spain_type'; }
...
...
...
else if ($country = 'Urugway') { $id = 'urugway_type'; }
else { $id = 'undefined'; }
else if statement repeats everytime, and other data is typical.
Is there a way to make this code shorter?
Like:
[france]:'france_type;
[england]:'england_type;
...
[else]:'undefined'
Thanks.