note 22148 deleted from function.phpversion by nlopess
| From: | nlopess@php.net | Date: | Thu, 26 Feb 2004 16:36:16 +0000 |
| Subject: | note 22148 deleted from function.phpversion by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65806@lists.php.net to get a copy of this message | ||
Note Submitter: ted@suzman.net
----
This function will return true if the specified version is older than the version the server is
running.
ex:
if(version_check('4.1.0')) die("PHP version 4.1.0 or greater is required.");
function version_check($vercheck)
{
$minver = explode(".", $vercheck);
$curver = explode(".", phpversion());
if(($curver[0] <= $minver[0]) && ($curver[1] <= $minver[1]) && ($curver[1]
<= $minver[1]) && ($curver[2][0] < $minver[2][0])) return true;
else return false;
}
Editor's Note:
.....................
Alternatively, you might want to check `version_compare()' function that does exactly this.