How to compare magento Check version programatically?

Solution 1 :

$fetchmagentoversion = Mage::getVersion();
if (version_compare($fetchmagentoversion, '1.8', '>='))
{
    //The result is 1.8 or greater
}
else {
    //The result is below 1.8
}


Solution 2 :

if(version_compare(Mage::getVersion(), '1.6.0.2') > 0)
{
    //this code working....
}
else
{
    //this code working....
}


EmoticonEmoticon