note 17965 modified in function.version-compare by maxim
| From: | maxim@php.net | Date: | Wed, 14 Aug 2002 02:11:34 +0000 |
| Subject: | note 17965 modified in function.version-compare by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34975@lists.php.net to get a copy of this message | ||
[Editor Note: an easy hack to get integer from PHP_VERSION is:
$php_version = (int) preg_replace("/[^\d]*/", '', PHP_VERSION);
]
Be aware that this function only works in v4.1.0 and above, I noticed only after implementing.
Anyway, here's a little snippet that you can use to check for a minimum version:
if (version_compare( phpversion(), "4.1.1") < 0)
echo "Minimum version not met.";
else
echo "You're in!";
--was--
Be aware that this function only works in v4.1.0 and above, I noticed only after implementing.
Anyway, here's a little snippet that you can use to check for a minimum version:
if (version_compare( phpversion(), "4.1.1") < 0)
echo "Minimum version not met.";
else
echo "You're in!";
http://www.php.net/manual/en/function.version-compare.php