Home >Backend Development >PHP Tutorial >PHP version extension comparison code sharing

PHP version extension comparison code sharing

小云云
小云云Original
2018-03-08 13:38:111396browse

This article mainly shares with you the PHP version extension comparison code, hoping to help everyone.

phpversion();//获取php版本1
if (version_compare(phpversion(), &#39;7.1&#39;, &#39;<&#39;)) {//php版本比较
        die("PHP version\e[31m must >= 7.1\e[0m\n");
    }
    if (version_compare(phpversion(&#39;swoole&#39;), &#39;1.9.5&#39;, &#39;<&#39;)) {//扩展比较
        die("Swoole extension version\e[31m must >= 1.9.5\e[0m\n");
    }

Related recommendations:

Detailed explanation on the error of PHP version number

Detailed explanation on how to upgrade the PHP version under Windows server

PHP version difference

The above is the detailed content of PHP version extension comparison code sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn