Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (17 sloc) 329 Bytes
<?php
if($a == 'ir') {
$country = 'iran';
}elseif($a == 'fr'){
$country = 'france';
}elseif($a == 'us'){
$country = 'usa';
}else{
$country = false;
}
//****************** Refactoring ***************************
$mapp = [
'ir' => 'iran',
'fr' => 'france',
'us' => 'usa'
];
$country = (isset($map[$a]))? $map[$a] : false;
You can’t perform that action at this time.