当前位置: 首页>>代码示例>>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;未经允许,请勿转载。