$versionInfo = Mage::getVersionInfo(); echo $versionInfo['major'].".".$versionInfo['minor'].".".$versionInfo['revision']." ".$versionInfo['patch']." ".$versionInfo['stability'];
$versionInfo = Mage::getVersionInfo(); if ($versionInfo['major'] == 1 && $versionInfo['minor'] == 9 && $versionInfo['revision'] >= 3) { // Do something for Magento 1.9.3.x installations } elseif ($versionInfo['major'] == 2 && $versionInfo['minor'] >= 0) { // Do something for Magento 2.x installations } else { // Do something for other Magento versions }This example shows how to conditionally execute code based on the Magento version. This could be useful for compatibility testing or for adding version-specific functionality. Package library: This function is part of the Magento Core library.