note 23562 deleted from function.version-compare by derick
| From: | derick@php.net | Date: | Sun, 01 Jun 2003 14:35:15 +0000 |
| Subject: | note 23562 deleted from function.version-compare by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49535@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster@mgs2online.f2s.com
----
you do not need all those tests. Try some code like this:
<?php
function minimum_version($vercheck)
{
$minver = (int)str_replace('.', '', $vercheck);
$curver = (int)str_replace('.', '', phpversion());
if($curver >= $minver)
return true;
return false;
}
if (!minimum_version('4.1.1'))
print 'Minimum version not met.';
else
print 'You\'re in!';
?>
Simply remove the dots and cast to an integer.