Home > Article > Backend Development > PHP version extension comparison code sharing
This article mainly shares with you the PHP version extension comparison code, hoping to help everyone.
phpversion();//获取php版本1 if (version_compare(phpversion(), '7.1', '<')) {//php版本比较 die("PHP version\e[31m must >= 7.1\e[0m\n"); } if (version_compare(phpversion('swoole'), '1.9.5', '<')) {//扩展比较 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
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!