當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PEAR::_explodePHPVersion方法代碼示例

本文整理匯總了PHP中PEAR::_explodePHPVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR::_explodePHPVersion方法的具體用法?PHP PEAR::_explodePHPVersion怎麽用?PHP PEAR::_explodePHPVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PEAR的用法示例。


在下文中一共展示了PEAR::_explodePHPVersion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: phpVersionIs

 /**
  * Find if a version is minor or greater than a given PHP version
  * (it should be red as "if my php version is minor|greater|between this one)
  *
  * Usage:
  * PEAR::phpVersionIs('4.0.7')           => if the current version
  *                                          is minor than version 4.0.7
  * PEAR::phpVersionIs(null, '4.0.12pl3') => if current is greater that 4.0.12pl3
  * PEAR::phpVersionIs('4.0.9', '4.0.4')  => if current is between 4.0.9 and 4.0.4
  *
  * @param string $minorthan   Version should be minor than this param
  * @param string $greaterthan Version should be greater than this param
  * @param string $version     Version to compare with (defaults to current)
  *
  * @return bool If the comparation was successful or not
  */
 function phpVersionIs($minorthan = null, $greaterthan = null, $version = PHP_VERSION)
 {
     $version = PEAR::_explodePHPVersion($version);
     $ret = false;
     if ($minorthan) {
         $minor = PEAR::_explodePHPVersion($minorthan);
         for ($i = 0; $i < count($version) - 1 and $minor[$i] == $version[$i]; $i++) {
         }
         if ($version[$i] >= $minor[$i]) {
             return false;
         }
         $ret = true;
     }
     if ($greaterthan) {
         $greater = PEAR::_explodePHPVersion($greaterthan);
         for ($i = 0; $i < count($version) - 1 and $greater[$i] == $version[$i]; $i++) {
         }
         $ret = $version[$i] > $greater[$i] ? true : false;
     }
     return $ret;
 }
開發者ID:a2call,項目名稱:commsy,代碼行數:37,代碼來源:PEAR.php


注:本文中的PEAR::_explodePHPVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。