Search code examples
osclass

OSclass osc_set_preferences not working on the second set


The below code works for the first $myurl1 only after setting for the first time, it doesnot set for the other statements, can anybody help on this.

$myurl="http://alberta.domain.com/";
$myurl2="http://toronto.domain.com/";
if ($myurl1) {
        osc_set_preference('subdomain_type', 'region', 'osclass');
        osc_reset_preferences();
} elseif ($myurl2) {
        osc_set_preference('subdomain_type', 'city', 'osclass');
        osc_reset_preferences();
} else {
       osc_set_preference('subdomain_type', 'country', 'osclass');
        osc_reset_preferences();
}

Solution

  • Since $myurl1 is not empty, if will only execute the first if statement. elseif or else will not be executed