references:joomla.framework:jversion-iscompatibleTable of Contents
isCompatible
Compares a “PHP standardized” version number against the current Joomla! version. This is useful if you would like to write extensions working only on some specific version of Joomla! This method can be called statically. Syntaxboolean isCompatible( string $minimum )
ExamplesFind if the present Joomla! installation matches version “1.5.0”. Provided the constant JVERSION has a value of “1.5.0”. Example $version_required = '1.5.0'; if ( JVersion::isCompatible($version_required) !== true ) { echo "Please install Joomla! ". $version_required ." to use this code."; } else { echo "Version requirements are set."; } might produce on success: Result Please install to Joomla! 1.5.0 to use this code. Known limitationsThe method is using PHP‘s Equal operator “eq” to compare the provided $minimum with JVERSION. If your code requires a specific version of Joomla! to be available, i.e. “1.5.0”, this method will perform as expected. If your code will perform as well with a (hypothetical) release “1.5.1” or “1.6.5”, the method will return false however. Use the native version_compare() function if you need a more sophisticated version comparision. Discussion |



