note 22183 added to function.phpversion

From: Date: Sun, 09 Jun 2002 19:00:47 +0000
Subject: note 22183 added to function.phpversion
Groups: php.notes 
Request: Send a blank email to php-notes+get-31640@lists.php.net to get a copy of this message
The above example made on 07-Jun-2002 does not take into account the significance of each number, instead it considers them as independant values. The incorrect inequality operators are also used to achieve the stated task. instead I suggest this: # return True if given php version is the same as or older than the version currently running function check_php_version ($version) { $testSplit = explode ('.', $version); $currentSplit = explode ('.', phpversion ()); if ($testSplit[0] < $currentSplit[0]) return True; if ($testSplit[0] == $currentSplit[0]) { if ($testSplit[1] < $currentSplit[1]) return True; if ($testSplit[1] == $currentSplit[1]) { if ($testSplit[2] <= $currentSplit[2]) return True; } } return False; } -- http://www.php.net/manual/en/function.phpversion.php http://master.php.net/manage/user-notes.php?action=edit+22183 http://master.php.net/manage/user-notes.php?action=delete+22183 http://master.php.net/manage/user-notes.php?action=reject+22183

« previous php.notes (#31640) next »